Repository navigation
Allow --select and --ignore to be combined - #433
sigmavirus24 wants to merge 3 commits into
Conversation
|
So right now this accommodates the use case in the commit message, select something broad but ignore the rest. It doesn't, however allow for the inverse, e.g., I'm not sure we need to either. Semantically that's the same thing as That said, it doesn't behave exactly the same way. Take for example The question I have is, do we want to pre-process these options to check for problems like this and warn the user or just silently do "the right thing"? Technically we've been doing what someone thought was the right thing for a while now and it's actually been not very intuitive. I'd love to get some feedback on this before proceeding. |
36541f9 to
1dfc7b8
Compare
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
The behaviour you described, where I feel like "most specific wins" is the least astonishing behaviour here, so for a file with
et cetera Naturally I've not yet looked into the practicalities of tests / implementation here, but I'd be interested in your views please! |
Demonstrate parsing of overlapping --select and --ignore
Right. I feel the same. To me, I'm thinking that we should say "well, the selected code(s) is(are) a subset of ignore, we should just use the generic |
I've played around with this in a few incarnations, and I'm not sure I follow what you mean, sorry. What would you expect the following to do on a file with E101 and E102 errors: |
|
So I wouldn't expect repeated usage of
|
|
Ah, I think I've realised my issue here - I'm interpreting I should have realised from the behaviour you demonstrated in #433 (comment) - my bad! I'm'a take some time to try fix my mental model ;) Thanks! |
|
@doismellburning no worries! |
|
@sigmavirus24 -- Other than the merge conflicts, do you believe this PR is mergeable? |
|
I suspect you might also have new / more insight now from your work with flake8 |
|
This could be merged. I'm less inclined to work on the rebase given that the functionality is included in Flake8 in a significantly better way that's far more powerful. I can rebase this, if people really want it here. Previously Flake8 needed it here but 3.0 makes it unnecessary. |
|
I think it would be valuable for those that don't use pycodestyle by way of flake8. I'll take it myself to update the pull request and merge it. |
Maybe but pycodestyle only had that bug reported by Flake8 users who were redirected here. Further, this is something of a breaking change that should have only been included in 2.0. So unless you're eager for a 3.0, I don't think this is a change you should deliver any time soon. |
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 #390
The tests are going to fail, but I wanted to throw this up for @glyph and others to test.