[code-quality] pylint 2.0 / astroid 2.0 released!

Kay Hayen kay.hayen at gmail.com
Mon Jul 16 07:56:02 EDT 2018


Hello PyLint team,

my congratulations too. I have a few questions though.

First of all, I am going to maintain my code base for Python2 and
Python3 dual lingo. Using both the Python2 and the Python3 variant of
PyLint, in different major versions poses a problem.

One thing I encounter is "too-many-statements", which was fixed a
bunch I assume. Now if I whitelist those, I will get
"useless-suppression" by PyLint 1.9.2 and will have to put that one
too,
which prevents me from noticing if it ever becomes unnecessary. I wish
there was a way for me, to not only do pylint:
disable=too-many-statements, but say pylint2:
disable=too-many-statements
and then only that "pylint2" version would consider it. But I assume,
you don't care about people who still care about Python2 code
correctness and Python3 correctness at the same time? It
must be a clear minority that I am in.

I might have to solve these warnings. In some places, I like to
tolerate breaking those rules, if there is nothing to gain from
breaking things up, say e.g. populating an option parser is going
to be a lot of statements, that is just that then.

The other is the new message that I am getting in cases:

nuitka\nodes\ExpressionBases.py:116 E1128 assignment-from-none
ExpressionBase.getStrValue Assigning to function call which only
returns None

For code like this:

    def getStringValue(self):
        """ Node as string value, if possible."""
        # Virtual method, pylint: disable=no-self-use
        return None

    def getStrValue(self):
        """ Value that "str" or "PyObject_Str" would give, if known.

            Otherwise it is "None" to indicate unknown. Users must not
            forget to take side effects into account, when replacing a
            node with its string value.
        """
        string_value = self.getStringValue()

        if string_value is not None:
            return makeConstantReplacementNode(
                node     = self,
                constant = string_value
            )

        return None

Obviously I have disabled the "useless-return" immediately, I am not
comfortable with explicit "None" returns not allowed, so do I have to
white list those,
because that is what virtual methods are for. I am not getting what
this is about, is my pattern here so uncommon?

Otherwise, I have a bug to report related to "bad-continuation", but I
will do this to the tracker later today.

Generally I liked the new warnings, which lead to improved code, esp.
the new chaining suggestions are full spot on.

Yours,
Kay


More information about the code-quality mailing list