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


Groups > comp.lang.python > #69854

Re: change spacing to two instead of four with pep8 or flake8?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.031
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'subject:two': 0.07; 'skip:\\ 10': 0.09; 'spaces': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; '-tkc': 0.16; 'command-line': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'ignoring': 0.16; 'pep8': 0.16; 'rules.': 0.16; 'spacing': 0.16; 'followed': 0.16; 'weird': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'possible,': 0.19; 'cc:addr:gmail.com': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**1': 0.23; 'align': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'that.': 0.31; 'enforce': 0.31; 'indentation': 0.31; 'option': 0.32; 'level.': 0.33; 'could': 0.34; 'subject:with': 0.35; 'agree': 0.35; 'something': 0.35; 'but': 0.35; 'doing': 0.36; 'next': 0.36; 'subject:?': 0.36; 'two': 0.37; 'expected': 0.38; 'problems': 0.38; 'generic': 0.38; 'expect': 0.39; 'catch': 0.60; 'numbers': 0.61; 'simply': 0.61; 'more': 0.64; 'skip:\xe2 10': 0.65; 'to:addr:gmail.com': 0.65; 'life': 0.66; '8bit%:21': 0.69; '8bit%:43': 0.74; 'goal': 0.75; '*really*': 0.84; 'it\xe2\x80\x99s': 0.84; 'obvious.': 0.84; 'received:50.22': 0.84; 'contents.': 0.91; 'don\xe2\x80\x99t': 0.91
Date Tue, 8 Apr 2014 06:53:26 -0500
From Tim Chase <python.list@tim.thechases.com>
To Chris “Kwpolska” Warrick <kwpolska@gmail.com>
Subject Re: change spacing to two instead of four with pep8 or flake8?
In-Reply-To <CAMw+j7K0erxF547tOhGttqK10StG9maB_k1yhP0VderP2v-YyQ@mail.gmail.com>
References <CANqRL=RBbfXJMFyV8w7J8Sdf+bRccOhK4kU6e60q1XcBX8GqSQ@mail.gmail.com> <CAMw+j7K0erxF547tOhGttqK10StG9maB_k1yhP0VderP2v-YyQ@mail.gmail.com>
X-Mailer Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Get-Message-Sender-Via boston.accountservergroup.com: authenticated_id: tim@thechases.com
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.9009.1396958011.18130.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396958011 news.xs4all.nl 2905 [2001:888:2000:d::a6]:55352
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69854

Show key headers only | View raw


On 2014-04-08 09:52, Chris “Kwpolska” Warrick wrote:
> On Tue, Apr 8, 2014 at 5:06 AM, Dennis <daodennis@gmail.com> wrote:
> > In Pylint you can change the spacing multiplier from 4 spaces to
> > two in its pylintrc, but for the life of me I cannot find a way
> > to do this with the flake8 / pep8 utilities.
> >
> > I want to avoid ignoring E111 altogether if at all possible,
> > because it may catch other spacing problems that are not as
> > obvious.
> 
> You are trying to use tools that enforce a set of rules, one of
> which is “use 4 spaces per indentation level”.  If you don’t agree
> with this rule, simply don’t use tools that enforce these rules.
> It’s that easy.
> 
> But note, that E111 is “indentation is not a multiple of four”.
> Which you are never going to listen to anyways if you want 2 spaces
> per indentation level.  If you *really* want to do 2 spaces (and
> look weird), then just ignore that.

It sounds like the OP wants a "indentation is not a multiple of N"
error/warning which would be a more generic (and as you state, look
weird doing so).  I wouldn't expect pep8 to do it, since its goal is
to align with pep8.  But I could see some of the other checkers
having a command-line option to set the expected indentation.

Otherwise, one might just do something like

  sed -n '/^\(  \)*\</!{=;p}'

which will print the offending line numbers on one line followed on
the next line by the offending line's contents.

-tkc

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


Thread

Re: change spacing to two instead of four with pep8 or flake8? Tim Chase <python.list@tim.thechases.com> - 2014-04-08 06:53 -0500

csiph-web