David Malcolm wrote:
On Tue, 2009-08-11 at 17:12 -0400, Rob Crittenden wrote:
Taking David Malcolm's advice I ran pylint and pychecker against a lot of the IPA code. Much of what it turned up was warnings/complaints about variable names, minor formatting, things like that. But it did also turn up a few bugs (using undefined exceptions, some references to non-existent variables, etc).


There are still a lot of places where we shadow built-in functions (filter is a common one). I see this as a first-pass at it.

I'll consider trying to come up with a config file we can pass to this so we can do some sort of 'make check' to catch errors. Right now the output is so copious it is difficult to tell wheat from chaff without reading carefully.

In case this is helpful, in another project, I had something like this
in the specfile (having created a pylintrc to suppress the various
warnings that I felt weren't important within that code)...



%define use_pylint 1

%if %{use_pylint}
BuildRequires:  pylint
%endif


and within the %build section:

%if %{use_pylint}
# Run pylint.  Halt the build if there are errors
# There doesn't seem to be a good way to get the result of pylint as an
# exit code.  (upstream bug: http://www.logilab.org/ticket/4691 )

# Capture the output:
pylint --rcfile=pylintrc . > pylint.log

# Ensure the pylint log makes it to the rpm build log:
cat pylint.log

# Analyse the "Messages by category" part of the report, looking for
# non-zero results:
# The table should look like this:
#   +-----------+-------+---------+-----------+
#   |type       |number |previous |difference |
#   +===========+=======+=========+===========+
#   |convention |0      |0        |=          |
#   +-----------+-------+---------+-----------+
#   |refactor   |0      |0        |=          |
#   +-----------+-------+---------+-----------+
#   |warning    |0      |0        |=          |
#   +-----------+-------+---------+-----------+
#   |error      |0      |0        |=          |
#   +-----------+-------+---------+-----------+
# # Halt the build if any are non-zero:
grep -E "^\|convention[ ]*\|0[ ]*\|" pylint.log || exit 1
grep -E "^\|refactor[ ]*\|0[ ]*\|" pylint.log || exit 1
grep -E "^\|warning[ ]*\|0[ ]*\|" pylint.log || exit 1
grep -E "^\|error[ ]*\|0[ ]*\|" pylint.log || exit 1
%endif


(Suggestions for improvements welcome)


I was wondering if pylint -e would be enough for automated tools.

rob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to