pylint woes

DFS nospam at dfs.com
Sat May 7 12:51:00 EDT 2016


This more-anal-than-me program generated almost 2 warnings for every 
line of code in my program.  w t hey?


                                           DFS comments
+-------------------------+------------+ -------------------------------
|message id               |occurrences |
+=========================+============+
|mixed-indentation        |186         | I always use tab
+-------------------------+------------+
|invalid-name             |82          | every single variable name?!
+-------------------------+------------+
|bad-whitespace           |65          | mostly because I line up =
                                          signs:
                                          var1  = value
                                          var10 = value

+-------------------------+------------+
|trailing-whitespace      |59          | heh!
+-------------------------+------------+
|multiple-statements      |23          | do this to save lines.
                                          Will continue doing it.
+-------------------------+------------+
|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?

+-------------------------+------------+
|line-too-long            |5           | meh
+-------------------------+------------+
|wrong-import-order       |4           | does it matter?
+-------------------------+------------+
|missing-docstring        |4           | what's the difference between
                                          a docstring and a # comment?
+-------------------------+------------+
|superfluous-parens       |3           | I like to surround 'or'
                                          statments with parens
+-------------------------+------------+
|redefined-outer-name     |3           | fixed. changed local var names.
+-------------------------+------------+
|redefined-builtin        |2           | fixed. Was using 'zip' and 'id'
+-------------------------+------------+
|multiple-imports         |2           | doesn't everyone?
+-------------------------+------------+
|consider-using-enumerate |2           | see below [1]
+-------------------------+------------+
|bad-builtin              |2           | warning because I used filter?
+-------------------------+------------+
|unused-import            |1           | fixed
+-------------------------+------------+
|unnecessary-pass         |1           | fixed. left over from
                                          Try..Except
+-------------------------+------------+
|missing-final-newline    |1           | I'm using Notepad++, with
                                          EOL Conversion set to
                                          'Windows Format'.  How
                                          or should I fix this?
+-------------------------+------------+
|fixme                    |1           | a TODO statement
+-------------------------+------------+

Global evaluation
-----------------
Your code has been rated at -7.64/10



I assume -7.64 is really bad?

Has anyone ever in history gotten 10/10 from pylint for a non-trivial 
program?




After fixes and disabling various warnings:
"Your code has been rated at 8.37/10"


That's about as good as it's gonna get!



[1]
pylint says "Consider using enumerate instead of iterating with range 
and len"

the offending code is:
for j in range(len(list1)):
   do something with list1[j], list2[j], list3[j], etc.

enumeration would be:
for j,item in enumerate(list1):
   do something with list1[j], list2[j], list3[j], etc.

Is there an advantage to using enumerate() here?









More information about the Python-list mailing list