Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot combine --select and --ignore #390

Open
glyph opened this issue Mar 11, 2015 · 3 comments
Open

cannot combine --select and --ignore #390

glyph opened this issue Mar 11, 2015 · 3 comments

Comments

@glyph
Copy link

glyph commented Mar 11, 2015

This means that specifying a project that forbids E226 but allows W503 is really tedious :). I hope I'm just missing something, but --select=W,E --ignore=W503 results in exactly the same behavior as just --select=W,E.

@sigmavirus24
Copy link
Member

This behaviour was introduced by 9a95d72 which I think was trying to be smarter about situations like --ignore W --select E24 which are functionally equivalent. It however, breaks this case which seems (to me) entirely reasonable.

sigmavirus24 added a commit to sigmavirus24/pep8 that referenced this issue Aug 27, 2015
This updates the logic in the StyleGuide to allow users to specify both
--select and --ignore to combine the power of both flags. Take for
example:

$ pep8 --select=E1 --ignore=E112 testsuite/E11.py

Will allow us to filter out E112 while selecting the E1xx checks in
general.

Closes PyCQA#390
sigmavirus24 added a commit to sigmavirus24/pep8 that referenced this issue Aug 28, 2015
Her we update the logic in the StyleGuide to allow users to specify both
--select and --ignore to combine the power of both flags. Take for
example:

$ pep8 --select=E1 --ignore=E112 testsuite/E11.py

The example shows that we are now allowed to filter out E112 while
selecting the other E1xx checks.

A (potentially unfortunate) consequence of this change is that if a user
specifies --select without --ignore and has codes ignored in their
config file, then we will merge that into the options and continue to
ignore those codes.

Closes PyCQA#390
sigmavirus24 added a commit to sigmavirus24/pep8 that referenced this issue Aug 28, 2015
Here we update the logic in the StyleGuide to allow users to specify both
--select and --ignore to combine the power of both flags. Take for
example:

$ pep8 --select=E1 --ignore=E112 testsuite/E11.py

The example shows that we are now allowed to filter out E112 while
selecting the other E1xx checks.

A (potentially unfortunate) consequence of this change is that if a user
specifies --select without --ignore and has codes ignored in their
config file, then we will merge that into the options and continue to
ignore those codes.

Closes PyCQA#390
@booxter
Copy link

booxter commented Jun 21, 2016

Just stumbled on that one in OpenStack Neutron where we inadvertently disabled all checks by enabling a single off_by_default check with select = in tox.ini. We are going to disable the selected check for the time being, but really, this should be solved in pep8.

@sigmavirus24
Copy link
Member

@booxter thanks for the data point. A few things:

  1. Flake8 has --enable-extensions for that exact reason (to work around this limitation)
  2. pep8 is dead and so the version of pep8 that hacking uses is unmaintained. Don't worry, I work on hacking and have it on my list to upgrade to flake8 2.6.0 to start consuming pycodestyle
  3. Flake8 3.0 is really close to being ready and makes this change completely irrelevant (and hacking is really just a plugin to Flake8)

openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Jun 21, 2016
Project: openstack/neutron  26230eb840df18f2e866ed12221a942a206c1729

Make pep8 job great again

There is a bug in pep8, when 'select' used, it omits all default checks
and runs only those specified by 'select'.  We got hit by this issue
since I2d26534230ffe5d01aa0aab6ec902f81cfba774d was merged which lead to
almost no static checks in pep8 job.

Also note that off_by_default decorator has no effect for now because
factory in hacking is triggered after ignored checks are collected.
There will be a follow-up patch for that in order to make pep8 doing
its job quickly.

[1] PyCQA/pycodestyle#390

Related-Bug: 1594756
Change-Id: I8e27f40908e1bb4307cc7c893169a9d99f3433c4
openstack-gerrit pushed a commit to openstack/neutron that referenced this issue Jun 21, 2016
There is a bug in pep8, when 'select' used, it omits all default checks
and runs only those specified by 'select'.  We got hit by this issue
since I2d26534230ffe5d01aa0aab6ec902f81cfba774d was merged which lead to
almost no static checks in pep8 job.

Also note that off_by_default decorator has no effect for now because
factory in hacking is triggered after ignored checks are collected.
There will be a follow-up patch for that in order to make pep8 doing
its job quickly.

[1] PyCQA/pycodestyle#390

Related-Bug: 1594756
Change-Id: I8e27f40908e1bb4307cc7c893169a9d99f3433c4
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Nov 9, 2016
Project: openstack/neutron  e62a670e703709cda12a671b8a50056239e48800

Switch to new hacking 0.12

The release includes its own check for delayed string interpolation for
log messages, so we can now remove our own check for the same thing. The
check is off-by-default, so we need to explicitly enable it. Sadly,
select= directive in tox.ini is broken [1] so we need to enable the
check with flake8 argument instead.

[1] PyCQA/pycodestyle#390

Change-Id: Idc6b8e5b1cb594e130d4cc0cbcfffd362f9ab86a
openstack-gerrit pushed a commit to openstack/neutron that referenced this issue Nov 9, 2016
The release includes its own check for delayed string interpolation for
log messages, so we can now remove our own check for the same thing. The
check is off-by-default, so we need to explicitly enable it. Sadly,
select= directive in tox.ini is broken [1] so we need to enable the
check with flake8 argument instead.

[1] PyCQA/pycodestyle#390

Change-Id: Idc6b8e5b1cb594e130d4cc0cbcfffd362f9ab86a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants