[code-quality] Searching multiple setup.cfg files for flake8 section?

Ian Lee ianlee1521 at gmail.com
Tue Jul 7 15:48:07 CEST 2015


On Tuesday, July 7, 2015, Ned Batchelder <ned at nedbatchelder.com> wrote:

>
>
> On 7/7/15 5:05 AM, Willy Wu via code-quality wrote:
>
> Hey all,
>
>  We use flake8 at Dropbox and are pretty happy with it.  But one small
> issue is the way that flake8 configuration gets discovered.  We use the
> per-project configuration via setup.cfg files which are checked into source
> control, but flake8 only considers the first setup.cfg in the directory
> path (regardless of whether it contains a flake8 section or not).  This
> forces us to duplicate our [flake8] configuration across all of our various
> setup.cfgs.
>
>  Said in crude ascii form, this is a simplified version of our project
> layout:
> - repo root
>   |- setup.cfg (default values)
>   \- subservice #1
>     \- setup.cfg (which has non-flake8 overrides for subservice #1)
>   \- subservice #2
>     \- setup.cfg (which similarly contains non-flake8 overrides for
> subservice #2)
>
>  But before I go off trying to patch flake8 code, is there relevant
> background on why you guys don't try to discover the first setup.cfg with a
> flake8 section, but instead just consider the first encountered setup.cfg?
> We've seen teams accidentally break flake8 checking whenever they add
> setup.cfg files for non-flake8 projects, and the "fix" is to copy/paste the
> flake8 section into those new files.
>
>  Or alternatively, should we be doing something different with our
> project layout as a workaround?  It's entirely possible that we should be
> configuring things differently overall...?
>
>
> I'm interested in this question for coverage.py.
>

This has been the bulk of the issue with solving this problem in pep8 as
well. Namely answering the question of which setup.cfg files to read, when
to stop (after reading the first with a particular section, or merge all
found?) and also whether per user or per project settings should take
precedence (additionally whether a config file specified with --config
should be the only configuration read or whether it should be merged with
per user and per project config, or be the only configuration used
(similarly for individual command line options).

I also agree with Ian's email asking for more information about your
specific use.


> Does setuptools or pip examine all of the setup.cfg files in your repo?  I
> wouldn't have guessed it would do that, I thought it would simply read the
> first one it finds.  I've never seen a project laid out like this, so it's
> all new to me.
>
> --Ned.
>
>
>  Thanks!
>
>  Willy
>
>
> _______________________________________________
> code-quality mailing listcode-quality at python.org <javascript:_e(%7B%7D,'cvml','code-quality at python.org');>https://mail.python.org/mailman/listinfo/code-quality
>
>
>
> _______________________________________________
> code-quality mailing list
> code-quality at python.org <javascript:;>
> https://mail.python.org/mailman/listinfo/code-quality
>
>

-- 

~ Ian Lee | IanLee1521 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20150707/0909dc6e/attachment-0001.html>


More information about the code-quality mailing list