Commit graph

35 commits

Author SHA1 Message Date
Anthony Sottile
ce274fb742 remove --statistics and --benchmarks 2022-09-29 15:12:55 -04:00
Anthony Sottile
e94fb10940 require python>=3.7 2022-08-05 19:51:08 -04:00
Anthony Sottile
3c885219b5 use typesafe NamedTuple 2022-01-05 13:02:38 -05:00
Ian Stapleton Cordasco
2bb0308363
Fix bug for plugins using extend_default_ignore
Since Flake8 3.0 we've had the ability for plugins to use
`extend_default_ignore` to register codes they want disabled by default.
This, however, was a permanent disabling unfortunately. Our code didn't
have a way of understanding that this new set of `ignore` codes was
actually the 'default' set for that run. Much like the
extended_select_list, we now attach extended_ignore_list to be able to
confidently determine if the ignore we get in the DecisionEngine is
actually the Default Ignore list and what plugins what us to ignore by
default.

Refs https://github.com/PyCQA/pep8-naming/pull/157
2021-04-15 13:26:08 -05:00
Frank Winklmeier
f98afbf7d9 Add --extend-select command line argument
Implement `--extend-select` command line argument following what was
done for `--extend-ignore` in !233. This option can be used to
selectively add individual codes without overriding the default list
entirely.

Addresses the remaining item of issue #1061.
2021-04-11 20:40:53 +02:00
Anthony Sottile
358ae85120 automatic: pyupgrade --py36-plus 2021-03-30 17:37:13 -07:00
Anthony Sottile
93a17a806d instrument coverage on tests and require 100% coverage there 2020-03-23 12:15:29 -07:00
Anthony Sottile
b66ebd7034 move from optparse to argparse 2019-08-17 20:09:45 -07:00
Anthony Sottile
b0ecf3d28f Fix flake8 --statistics 2019-01-30 14:39:24 -08:00
Anthony Sottile
be88d26396 Remove unused and broken flake8.listen plugin type 2018-12-27 16:55:15 -08:00
Ian Stapleton Cordasco
1433a008b3
Add tests for the expected behaviour of per-file-ignores
These show that there were some subtle bugs in how we were matching
things and that there are bugs that need to be fixed.
2018-10-27 08:01:14 -05:00
Ville Skyttä
e520c2d936 Implement --extend-ignore
Refs #365
2018-05-16 08:50:26 +02:00
Ian Cordasco
92c367dee4
Rename style_guide.Error to style_guide.Violation
Move all Violation related methods from the StyleGuide to our Violation
class.
2017-06-04 07:57:28 -05:00
Ian Cordasco
583fda7a70
Move unit tests for StyleGuide decision logic
Convert it to test the DecisionEngine class directly and put them in
their own file.
2017-06-02 19:16:28 -05:00
Ian Cordasco
7fef0af0f5
Refactor decision logic into its own object
In dealing with the decision logic in the StyleGuide recently I
recognized that the logic really doesn't belong strictly on the
StyleGuide. A separate object makes perfect sense especially from the
perspective of testability. This is a minor refactor intended solely to
facilitate further testing and perhaps making the logic easier to
understand for others.
2017-06-01 20:36:37 -05:00
Ian Cordasco
aefa79535f
Simplify conditoinal in decision logic
Add test to cover branch of decision logic we were not previously
exercising
2017-05-27 20:34:04 -05:00
Ian Cordasco
178092954d
Add extra test cases for violation decisions 2017-05-27 20:16:15 -05:00
Ian Cordasco
2baaf00e83
Further refine our logic handling selection
There was a *very* subtle bug in how we handle blanket select statements
with error codes that are in our DEFAULT_IGNORE. In the specific case,
users were specifying ``--select E`` and E126 was not being properly
reported. This unveiled further logic bugs as we refined this.

Closes #318
2017-05-27 19:22:38 -05:00
Ian Cordasco
c50b747a1a
Fix subtle reporting bug for default on plugins
When we refactored our decision process to fix #239, we broke a subtle
corner case where extensions that are not off-by-default are to be
reported.

This further refactors that logic and adds specific tests around it to
ensure it works as expected and doesn't regress.

Closes #257
2016-11-15 19:56:18 -06:00
Ian Cordasco
4f04ca549b
Handle a previously unhandled code scenario
Previously, we didn't handle the case where an error code was implicitly
ignored (by not being in --select) and implicitly selected (by not being
in --ignore). This means we need to update StyleGuide#_decision_for and
StyleGuide#is_user_selected to handle these cases.

Closes #242
Related-to #239
Related-to !132
2016-11-08 20:00:01 -06:00
Ian Cordasco
68a273144e
Fix bug with --enable-extensions
We went through an iteration where we supported --enable-extensions and
then didn't. This adds back our support for --enable-extensions.

Closes #239
2016-10-25 19:28:52 -05:00
Ian Cordasco
1631ab8ac7
Add failing test for NoneType in handle_error
There are rare cases when StyleGuide#handle_error might receive None
as the column_number. This adds the failing test to ensure we don't
regress the correct behaviour.

Related-to #214
2016-08-27 19:44:24 -05:00
Ian Cordasco
c670217c24
Allow plugins that are on by default to be ignored
Previously, to ensure that plugins on by default were reported, we
added them to the select list. This means that ignoring them became
impossible. To accomodate our reporting logic and a user's ability
to ignore, we need to keep our select and extended select lists
separated.

This allows us to have a better understanding of who is selecting what,
where, and how and make our decision as to whether or not an error
should be reported more wisely.

Closes #195
2016-07-28 19:28:13 -05:00
Ian Cordasco
c0ddc54f2f
Match noqa for users with explanations
This makes the regular expression a bit more complex, and potentially
slower, but it will fix the issue where users had noqa comments with
colons followed by explanations.

Closes #178
2016-07-28 06:48:15 -05:00
Ian Cordasco
6eca38f2f2
Fix zero-indexed column numbering
We accidentally changed column numbering from one-indexed to
zero-indexed.
2016-07-26 19:45:05 -05:00
Ian Cordasco
f82b5d62d0
Update NOQA regular expression
This allows for other text after `# noqa`.

Related to #180
2016-07-26 06:24:04 -05:00
Ian Cordasco
8bc76f79de
Configure flake8-import-order to use Google Style
This relies on two things:

1. Properly configuring flake8-import-order to use that style
2. Properly configuring flake8-import-order to know that flake8 is our
   application name.
2016-06-17 10:26:36 -05:00
Ian Cordasco
15043a4ab7 Update our linecache test to correct it 2016-05-30 16:48:30 -05:00
Ian Cordasco
467672fc5c Refactor Error formatting and handling
This allows us to handle --show-source in our formatters by default.

This also adds the physical line information to the Error class instead
of passing it to is_inline_ignored. This allows us to avoid using
linecache in our formatters.
2016-05-30 16:43:11 -05:00
Ian Cordasco
de9f56addf Fix import ordering in test files 2016-02-25 14:41:37 -06:00
Ian Cordasco
58b2ca69e4 Remove arguments from StyleGuide
- StyleGuides do not need the arguments passed in
- Add a test for is_inline_ignored obeying disable_noqa
2016-02-19 16:10:38 -06:00
Ian Cordasco
fbd5944f15 Add specific tests for is_inline_ignored
Update the logic so someone can use a class in their ``# noqa`` ignore
list
2016-02-19 11:02:22 -06:00
Ian Cordasco
f4b18229a0 Add checking for inline #noqa comments
This also supports ignoring only specified codes
2016-02-19 09:08:24 -06:00
Ian Cordasco
a9a939cbbc Update StyleGuide tests and add new tests for handle_error 2016-02-15 22:31:56 -06:00
Ian Cordasco
eafc91ae6a Add handling and decision making for select and ignore 2016-02-02 20:48:26 -06:00