pylint woes
Terry Reedy
tjreedy at udel.edu
Sat May 7 15:40:23 EDT 2016
On 5/7/2016 12:51 PM, DFS wrote:
> This more-anal-than-me program generated almost 2 warnings for every
> line of code in my program. w t hey?
If you don't like it, why do you use it?
I suppose the answer is that it did find a few things to check. You
might be happier with pychecker, which is much less aggressive. I
believe will find the things you did fix.
> DFS comments
> +-------------------------+------------+ -------------------------------
> |message id |occurrences |
> +=========================+============+
> |mixed-indentation |186 | I always use tab
> +-------------------------+------------+
> |invalid-name |82 | every single variable name?!
I would need examples to comment.
> +-------------------------+------------+
> |trailing-whitespace |59 | heh!
Any code editor should have a command to fix this.
IDLE: Format => strip trailing whitespace
Notepad++: Macro => trim trailing and save, Alt-Shift-S
others ...
> +-------------------------+------------+
> |no-member |5 |
>
> "Module 'pyodbc' has no 'connect' member" Yes it does.
> "Module 'pyodbc' has no 'Error' member" Yes it does.
>
> Issue with pylint, or pyodbc?
Worth looking into. Could be a bug somewhere. But I don't have pyodbc
installed.
> +-------------------------+------------+
> |line-too-long |5 | meh
For following the PEP guideline when patching CPython, this is helpful.
> +-------------------------+------------+
> |wrong-import-order |4 | does it matter?
Consistency in imports ultimately makes easier reading.
Many idlelib files use this order: stdlib modules other than tkinter and
idlelib (alphabetically); tkinter (tkinter first, then submodules);
idlelib (alphabetically). When I edit files, I sometimes reorder
imports to conform.
> +-------------------------+------------+
> |missing-docstring |4 | what's the difference between
> a docstring and a # comment?
# Comments only appear in the source
'''Docstrings are copied to the compiled code object, are interactively
accessible, and are used for help(ojb) output.'''
> +-------------------------+------------+
> |superfluous-parens |3 | I like to surround 'or'
> statments with parens
I would need examples to comment
> +-------------------------+------------+
> |bad-builtin |2 | warning because I used filter?
If they are still doing this in the latest release, it is an arrogance
and inconsistency bug on their part. Disable this check.
> +-------------------------+------------+
> |missing-final-newline |1 | I'm using Notepad++, with
> EOL Conversion set to
> 'Windows Format'.
That says to replace final '\n' with '\r\n'. It does not affect a
missing final newline ;-)
How or should I fix this?
Fix by hitting 'Enter' at the end of the last line.
Should you? I think it a good habit.
> After fixes and disabling various warnings:
> "Your code has been rated at 8.37/10"
Being able to customize pylint by turning off warnings is its saving
feature.
--
Terry Jan Reedy
More information about the Python-list
mailing list