Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108279

Re: pylint woes

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Michael Selik <michael.selik@gmail.com>
Newsgroups comp.lang.python
Subject Re: pylint woes
Date Sat, 07 May 2016 18:42:33 +0000
Lines 156
Message-ID <mailman.459.1462646572.32212.python-list@python.org> (permalink)
References <ngl677$68p$1@dont-email.me> <CAGgTfkNVpVG7xfNvrDV3xfdpAojNR_0C_m4VVu_Pn2TtwenNTg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de VNJlVRTA80fmaudxJ5R9GgtPooZE0L3xA8m5E1RUOjiw==
Return-Path <michael.selik@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'bytes.': 0.07; 'lines.': 0.07; 'edward': 0.09; 'pyodbc': 0.09; 'tab': 0.09; 'yeah,': 0.09; 'python': 0.10; 'assume': 0.11; 'read.': 0.13; 'suggest': 0.15; '2016': 0.16; 'advice:': 0.16; 'code?': 0.16; 'conforming': 0.16; 'contributors': 0.16; 'dfs': 0.16; 'docstring': 0.16; 'file.\xc2\xa0': 0.16; 'member"': 0.16; 'non-trivial': 0.16; 'program?': 0.16; 'programmers,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:| 20': 0.16; 'statments': 0.16; 'still,': 0.16; 'sure.': 0.16; 'tabs': 0.16; "team's": 0.16; 'wrote:': 0.16; 'attribute': 0.18; 'fixed.': 0.18; 'skip:+ 40': 0.18; 'team,': 0.18; 'variable': 0.18; 'fix': 0.21; 'to:2**1': 0.21; 'names.': 0.22; 'ok.': 0.22; 'rid': 0.22; 'file.': 0.22; 'sat,': 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'module': 0.25; "doesn't": 0.26; 'chris': 0.26; 'skip:" 20': 0.26; 'error': 0.27; 'mostly': 0.27; 'message- id:@mail.gmail.com': 0.27; 'var': 0.27; 'docstrings': 0.29; 'selecting': 0.29; 'spaces': 0.29; 'style.': 0.29; 'sure,': 0.29; 'convert': 0.29; "i'm": 0.30; 'comments': 0.30; 'code': 0.30; 'skip:& 30': 0.30; 'standards': 0.30; 'users.': 0.31; 'probably': 0.31; 'certain': 0.31; 'fixed': 0.31; 'anyone': 0.32; "can't": 0.32; 'core': 0.32; 'says': 0.32; '[1]': 0.32; 'statement': 0.32; 'maybe': 0.33; 'changed': 0.33; 'class': 0.33; 'usually': 0.33; 'skip:- 10': 0.34; 'editor': 0.34; 'this?': 0.34; 'skip:d 20': 0.34; 'add': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'filter': 0.35; 'mix': 0.35; 'todo': 0.35; 'community': 0.36; 'but': 0.36; 'too': 0.36; 'skip:i 20': 0.36; 'should': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'evaluation': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'things': 0.38; 'doing': 0.38; 'difference': 0.38; 'received:209': 0.38; 'names': 0.38; 'end': 0.39; 'why': 0.39; 'does': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'some': 0.40; 'easy': 0.60; 'ever': 0.60; 'save': 0.60; 'high': 0.60; 'your': 0.60; 'share': 0.61; "you'll": 0.61; 'no.': 0.62; 'per': 0.62; 'yes': 0.62; 'skip:n 10': 0.62; 'needing': 0.63; 'different': 0.63; 'you.': 0.64; 'between': 0.65; 'six': 0.65; 'today': 0.65; 'better.': 0.66; 'matter.': 0.66; 'expert': 0.70; 'levels': 0.70; 'further,': 0.72; 'gotten': 0.76; 'sounds': 0.76; 'rated': 0.84; 'skip:| 10': 0.84; 'surround': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=q7cdCTlJQ0jZGDcTePRBvom/euePXPSL7rhzw/jXc18=; b=vRJQFE91VfDm1xXauekAA/7YvIsuqXDnV1gWrNOZ/BwBdKFb6zOQU5Dz1rT77eDaVF kYnbBX8O12gX+1NjR/MAK5i88Xn41lnzq0j0rhr/5zzuocuK/Gu8qfvwG4gnMTbijr56 OhqRm6DMOrSrW9QjdGntzfflFgZde3BJwsUMox/UyuvmXOQiR0Kx5JlmWBuJts8HH7Ua G85Kq+681+H9JqhYQeF/nNEKEJx/fpRYWFx0/zNZAWF0MEONQr5Mla9Kwv3Hmq6wJWKl S8SzMsM/53RNMUr/Drr6klqgYMx8EDlOGwnAFu1AO+9JXiPb8mH47lmHRFthRB6Gt5Uc mhzA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=q7cdCTlJQ0jZGDcTePRBvom/euePXPSL7rhzw/jXc18=; b=EQGMi8jZoy40xTyeR2Rhpr28VHAuz9TFSJALHXZv+9VSZTIM930s6bMCgOfJT2lZ/N B8y8SmHHyg02vYrUHicCJ7CKy3T3DldqxfTS7tfDtkVLTmHJOIAv8jEOmTZiObOlbfGV EGkeXidmtd05N6RNXIgG9xIlBvosndJdtOSX2iA1xSnD6a+LoPUWFFnEC0EOaGiBXRQv jwe94oNI8YEFYtpqbakjyCDT5nTs6S0FeHwuKss0Ez77nKZB7dSW0T4+ykK3SNGUZj02 RfBYOD0P3YVTmbEoq76EDei8omVqEhYIhl1e0OzuiFYiHfk6NDbvJL+0Yc/ASztxAiuY D83Q==
X-Gm-Message-State AOPr4FUZaWw2QgcozFN7YLGx6GYv95Bsm5Yrujl0ZeSXvCgbfSXfF8RsTE52AAvy1RUdA0VPJX+zrluNjjWJkQ==
X-Received by 10.140.108.247 with SMTP id j110mr27107060qgf.54.1462646563064; Sat, 07 May 2016 11:42:43 -0700 (PDT)
In-Reply-To <ngl677$68p$1@dont-email.me>
X-Content-Filtered-By Mailman/MimeDel 2.1.22
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAGgTfkNVpVG7xfNvrDV3xfdpAojNR_0C_m4VVu_Pn2TtwenNTg@mail.gmail.com>
X-Mailman-Original-References <ngl677$68p$1@dont-email.me>
Xref csiph.com comp.lang.python:108279

Show key headers only | View raw


On Sat, May 7, 2016 at 12:56 PM DFS <nospam@dfs.com> wrote:

> |mixed-indentation        |186         | I always use tab
>

Don't mix tabs and spaces. I suggest selecting all lines and using your
editor to convert spaces to tabs. Usually there's a feature to "tabify".


> +-------------------------+------------+
> |invalid-name             |82          | every single variable name?!
>

Class names should be CamelCase
Everything else should be lowercase_with_underscores


> +-------------------------+------------+
> |bad-whitespace           |65          | mostly because I line up =
>                                           signs:
>                                           var1  = value
>                                           var10 = value
>

Sure, that's your style. But pylint likes a different style. It's good to
use a standard. If it's just you, I suggest conforming to pylint. If you're
already on a team, use your team's standard.

+-------------------------+------------+
> |trailing-whitespace      |59          | heh!
>

Get rid of it. Save some bytes.


> +-------------------------+------------+
> |multiple-statements      |23          | do this to save lines.
>                                           Will continue doing it.
>

If you want to share your code with others, you should conform to community
standards to make things easier for others to read. Further, if you think
the core contributors are expert programmers, you should probably take
their advice: "sparse is better than dense". Do your future-self a favor
and write one statement per line. Today you find it easy to read. Six
months from now you won't.


> +-------------------------+------------+
> |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?
>

Not sure. Maybe pyodbc is written in a way that pylint can't see it's
connect or Error method/attribute.


> +-------------------------+------------+
> |line-too-long            |5           | meh
>

Yeah, I think 80 characters can be somewhat tight. Still, 5 long lines in
200ish lines of code? Sounds like you might be doing too much in those
lines or have too many levels of indentation.
"Sparse is better than dense"
"Flat is better than nested"


> +-------------------------+------------+
> |wrong-import-order       |4           | does it matter?
>

No. I think pylint likes to alphabetize. With only 4 imports, it doesn't
matter. Still, why not alphabetize?


> +-------------------------+------------+
> |missing-docstring        |4           | what's the difference between
>                                           a docstring and a # comment?
>

Docstrings are tools for introspection. Many things in Python access the
__doc__ attribute to help you. Comments are never seen by module users.


> +-------------------------+------------+
> |superfluous-parens       |3           | I like to surround 'or'
>                                           statments with parens
>

Ok. But over time you'll get used to not needing them. Edward Tufte says
you should have a high "information-to-ink" ratio.


> +-------------------------+------------+
> |redefined-outer-name     |3           | fixed. changed local var names.
> +-------------------------+------------+
> |redefined-builtin        |2           | fixed. Was using 'zip' and 'id'
> +-------------------------+------------+
> |multiple-imports         |2           | doesn't everyone?
>

Yeah, I do that as well.


> +-------------------------+------------+
> |consider-using-enumerate |2           | see below [1]
>

As Chris explained.


> +-------------------------+------------+
> |bad-builtin              |2           | warning because I used filter?
>

I think pylint likes comprehensions better. IMHO filter is OK. If you're
using a lambda, change to a comprehension.


> +-------------------------+------------+
> |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?
>

Add a few blank lines to the end of your file.


> +-------------------------+------------+
> |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?
>

I'm certain of it.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pylint woes DFS <nospam@dfs.com> - 2016-05-07 12:51 -0400
  Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 03:01 +1000
    Re: pylint woes DFS <nospam@dfs.com> - 2016-05-07 21:16 -0400
      Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 11:36 +1000
        Re: pylint woes DFS <nospam@dfs.com> - 2016-05-07 22:15 -0400
          Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 12:50 +1000
            Re: pylint woes DFS <nospam@dfs.com> - 2016-05-10 18:36 -0400
              Re: pylint woes MRAB <python@mrabarnett.plus.com> - 2016-05-11 02:02 +0100
      Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-07 19:14 -0700
        Re: pylint woes DFS <nospam@dfs.com> - 2016-05-07 23:04 -0400
          Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-07 20:46 -0700
            Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 10:26 -0400
          Re: pylint woes Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-05-08 08:50 +0300
            Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 10:25 -0400
              Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-09 00:36 +1000
                Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 11:06 -0400
                Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-08 08:15 -0700
                Re: pylint woes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-05-09 13:17 +1200
                Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-09 12:18 +1000
                Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 22:58 -0400
                Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-09 01:15 +1000
                Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 17:06 -0400
              Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-08 08:11 -0700
              Re: pylint woes Steven D'Aprano <steve@pearwood.info> - 2016-05-09 01:51 +1000
                Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 17:04 -0400
                Re: pylint woes Steven D'Aprano <steve@pearwood.info> - 2016-05-09 13:09 +1000
      Re: pylint woes MRAB <python@mrabarnett.plus.com> - 2016-05-08 03:21 +0100
      Re: pylint woes Steven D'Aprano <steve@pearwood.info> - 2016-05-08 21:36 +1000
        Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 17:24 -0400
          Re: pylint woes Joel Goldstick <joel.goldstick@gmail.com> - 2016-05-08 17:39 -0400
          Re: pylint woes Steven D'Aprano <steve@pearwood.info> - 2016-05-09 13:46 +1000
  Re: pylint woes Michael Selik <michael.selik@gmail.com> - 2016-05-07 18:42 +0000
  Re: pylint woes Peter Pearson <pkpearson@nowhere.invalid> - 2016-05-07 18:43 +0000
    Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 17:05 -0400
  Re: pylint woes Christopher Reimer <christopher_reimer@icloud.com> - 2016-05-07 11:52 -0700
    Re: pylint woes DFS <nospam@dfs.com> - 2016-05-07 23:38 -0400
      Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 13:56 +1000
      Re: pylint woes Peter Otten <__peter__@web.de> - 2016-05-08 16:19 +0200
  Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-07 12:21 -0700
  Re: pylint woes Stephen Hansen <me@ixokai.io> - 2016-05-07 12:23 -0700
  Re: pylint woes Terry Reedy <tjreedy@udel.edu> - 2016-05-07 15:40 -0400
    Re: pylint woes DFS <nospam@dfs.com> - 2016-05-07 23:28 -0400
      Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 13:51 +1000
        Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 00:40 -0400
          Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 14:55 +1000
      Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-07 20:55 -0700
      Re: pylint woes Ian Kelly <ian.g.kelly@gmail.com> - 2016-05-07 23:09 -0600
      Re: pylint woes Peter Otten <__peter__@web.de> - 2016-05-08 16:12 +0200
  Re: pylint woes Christopher Reimer <christopher_reimer@icloud.com> - 2016-05-07 12:43 -0700
  Re: pylint woes Ray Cote <rgacote@appropriatesolutions.com> - 2016-05-07 15:52 -0400
  Re: pylint woes Christopher Reimer <christopher_reimer@icloud.com> - 2016-05-07 13:20 -0700
  Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 07:56 +1000
  Re: pylint woes Terry Reedy <tjreedy@udel.edu> - 2016-05-07 21:44 -0400
  Re: pylint woes Steven D'Aprano <steve@pearwood.info> - 2016-05-08 13:25 +1000
    Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 00:10 -0400
      Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 14:21 +1000
      Re: pylint woes "D'Arcy J.M. Cain" <darcy@VybeNetworks.com> - 2016-05-08 08:50 -0400
      Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-08 23:01 +1000
        Re: pylint woes Larry Hudson <orgnut@yahoo.com> - 2016-05-08 13:45 -0700
          Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-09 08:07 +1000
            Re: pylint woes Larry Hudson <orgnut@yahoo.com> - 2016-05-08 18:28 -0700
        Re: pylint woes Dan Sommers <dan@tombstonezero.net> - 2016-05-08 20:49 +0000
          Re: pylint woes Chris Angelico <rosuav@gmail.com> - 2016-05-09 08:10 +1000
      Re: pylint woes Steven D'Aprano <steve@pearwood.info> - 2016-05-09 03:25 +1000
        Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 17:16 -0400
          Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-08 14:38 -0700
            Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 17:46 -0400
              Re: pylint woes Stephen Hansen <me+python@ixokai.io> - 2016-05-08 15:05 -0700
                Re: pylint woes DFS <nospam@dfs.com> - 2016-05-08 18:24 -0400

csiph-web