[Freeipa-devel] Utility modules and unused code

Petr Viktorin pviktori at redhat.com
Fri Apr 13 13:46:16 UTC 2012


I've started looking at our test coverage and noticed that our utility 
modules have a lot of stuff that's not only untested, but also unused.
Some of these are left over from Radius support or other ancient code.

What to do with these? Remove them for 3.0, or be careful and just 
deprecate them with a warning?
Or did I look wrong and some of them still useful?


Seeing the util modules, I'd recommend to leave future code that *could* 
be potentially useful in more places, but currently isn't, near the 
place that uses it. It is easy to put in a common location if there's 
need for it later, but removing something once all its dependencies are 
gone is more problematic.
Not to mention that it's hard to write generic code when there's just 
one use for it, or that such code is hard to change once something else 
might depend on it.




Unused code I found:

ipapython/ipautil.py:
format_list
parse_key_value_pairs
read_pairs_file
user_input_plain
AttributeValueCompleter
ItemCompleter

ipaserver/ipautil.py:
get_gsserror [ipapython.ipautil.get_gsserror (!!) is similar but used]

ipalib/util.py:
load_plugins_in_dir
import_plugins_subpackage
make_repr [in imports & its test only]

Some functions appear in more places and are the same:
realm_to_suffix
get_fqdn

(I used `git grep` to look for usage. There are ways to refer to an 
object without its literal name, but I doubt we're doing that)


-- 
Petr³




More information about the Freeipa-devel mailing list