Commit graph

41 commits

Author SHA1 Message Date
Anthony Sottile
fba6df88f9 remove --diff option 2022-10-26 20:39:12 -07:00
Anthony Sottile
e94fb10940 require python>=3.7 2022-08-05 19:51:08 -04:00
Anthony Sottile
d03b9c97cc add a --require-plugins option 2022-01-22 14:08:32 -05:00
Anthony Sottile
4cb1dc8c44 perform path normalization on '.' 2022-01-05 11:44:31 -05:00
Anthony Sottile
50d69150c1 rework plugin loading 2021-12-31 15:09:54 -08:00
Anthony Sottile
66071563c2 split out file discovery and test it 2021-11-14 20:04:29 -08:00
Anthony Sottile
0c62569c4f remove dead code
detected using https://github.com/asottile/dead
2021-11-14 08:40:34 -08:00
Anthony Sottile
af1668bf04 extend black formatting to tests as well 2021-04-18 09:23:48 -07:00
Anthony Sottile
737e0492d0 improve code coverage in a few places 2021-04-07 08:52:26 -07:00
Anthony Sottile
edadccd8dc audit + string joining 2021-03-30 17:37:13 -07:00
Anthony Sottile
5d43462c9d clean up version_info references 2021-03-30 17:37:13 -07:00
Anthony Sottile
358ae85120 automatic: pyupgrade --py36-plus 2021-03-30 17:37:13 -07:00
Anthony Sottile
0bf8d2a885 ensure crlf line endings of stdin are handled properly 2021-01-07 09:15:46 -08:00
Anthony Sottile
9e67511c69 Fix using --exclude=.* to not match . and .. 2020-05-07 12:34:38 -07:00
Anthony Sottile
93a17a806d instrument coverage on tests and require 100% coverage there 2020-03-23 12:15:29 -07:00
Eric N. Vander Weele
1757bce321 utils: Tighten parse_comma_separated_list() contract further
Now that callers are ensuring that `value` is not `None`, we can further
tighten the contract and remove the conditional to account when `None`
is passed-in for `value`.

Additionally, add a new test vector to account for when an empty string
is passed in, which would fail `if no value`.
2019-07-28 10:43:06 -04:00
Eric N. Vander Weele
1ba56b9056 utils: Change normalize_paths() contract
The `normalize_paths()` utility was doing too much — parsing
unstructured configuration path data and dispatching the scrubbed paths
to be normalized.

Towards moving the parsing of unstructured configuration path data
closer towards were configuration occurs, have the utility accept only
structured input for normalizing paths.
2019-07-28 10:43:06 -04:00
Eric N. Vander Weele
9283f2f03f utils: Change parse_comma_separated_list() contract
This is the initial incision point to only accept `str` (or `None`) for
parsing out comma/whitespace/regexp separated values.
2019-07-28 10:43:02 -04:00
Anthony Sottile
d4b0073167 Fix / improve recently merged patches + CI 2019-07-08 14:22:51 -07:00
Anthony Sottile
0d7247082e Merge branch 'master' into 'master'
Remove filter by filename in utils.filenames_from

Closes #382

See merge request pycqa/flake8!311
2019-07-08 20:11:25 +00:00
Anthony Sottile
fb7e9338cd mypy now passes 2019-05-19 17:31:04 -07:00
Yevhen Amelin
6fb49b2e80 Remove filter by filename in utils.filenames_from 2019-03-19 09:59:12 +02:00
Илья Лебедев
8e99b531cf FIX 507: allow multiple letters in codes 2019-02-11 17:00:34 +03:00
Anthony Sottile
f955a98b71 Improve error message for malformed per-file-ignores 2019-01-30 19:33:54 -08:00
Anthony Sottile
0c470a65d7 Allow capitalized filenames in per-file-ignores 2019-01-29 23:17:45 -08:00
Anthony Sottile
9788b87c91 Support more syntaxes in per-file-ignores 2019-01-07 19:35:41 -08:00
Ian Stapleton Cordasco
ec996ffd85
Allow spaces in # noqa lists
To match our new configuration file format and its allowance for spaces
in the list

Closes #356
2017-07-28 19:31:32 -05:00
Ian Cordasco
a42299d008
Support spaces as error/ignore code separators
Closes #329
2017-05-25 20:07:48 -05:00
Ian Cordasco
25566468a2
Filter out empty ignore/select codes
When we parse out our comma separated lists, we should ignore empty
strings to avoid them breaking users' expectations.

Closes #330
2017-05-20 20:26:27 -05:00
Anthony Sottile
0559e0b43c Don't apply excludes greedily to subdirs 2017-03-16 13:44:33 -07:00
Ian Cordasco
2d3e277b1e
Handle optional parameters that were never supported
Previously, pycodestyle never introspected the argument names for
classes except to require that ``tree`` be an argument it could pass.
For Flake8 3.0, we lifted that restriction, but old plugins seem to
have cargo-culted their __init__ signature to be

    def __init__(self, tree, builtins=None):

For some yet unknown reason. This was causing an AttributeError. By
updating flake8.utils.parameters_for to return a dictionary that
indicates whether the parameter is required or not, we can side-step
this by simply ignoring the parameter if it has a default value and
we cannot provide it.

Closes #151
2016-06-28 09:36:24 -05:00
Ian Cordasco
1a2c68f5da
Move flake8 into src
This is an emerging best practice and there is little reason to not
follow it
2016-06-25 10:12:13 -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
9ebaa5c69c
Add tests for parse_unified_diff
We could probably use non-git diff fixtures, but those are what we have
for now.
2016-06-07 10:14:45 -05:00
Ian Cordasco
de9f56addf Fix import ordering in test files 2016-02-25 14:41:37 -06:00
Ian Cordasco
a4e984dbd2 Add and fix documentation
- Add more documentation around utils functions
- Fix documentation about default formatting plugins
- Add extra documentation of filenames_from predicate parameter
- Add test for the default parameter of flake8.utils.fnmatch
2016-02-25 09:06:50 -06:00
Ian Cordasco
24d2689a05 Distinguish check types via plugin type manager
Flake8 and pep8 has historically supported three types of checks:

- Plugins that accept the physical line
- Plugins that accept the logical line
- Plugins that accept the AST tree

The logical place to make this distinction is on the Checkers plugin
type manager class. This adds the foundation for finding plugins that
fall into each class.
2016-02-23 23:20:34 -06:00
Ian Cordasco
8792c30872 Add utility functions around filename matching
We add utils.fnmatch and utils.filenames_for in anticipation of our
checker manager creating file checkers for each file. We also include
tests for these functions and a couple previously untested utility
functions.
2016-02-22 21:47:43 -06:00
Ian Cordasco
8c872c4bb9 Add more docstrings and fix lint errors 2016-01-10 14:47:06 -06:00
Ian Cordasco
ec26d46dff Add tests for normalize_path and normalize_paths 2016-01-09 21:04:11 -06:00
Ian Cordasco
a4042d6d69 Start fleshing out flake8.utils
Add parse_comma_separated_list, normalize_path, and normalize_paths and
add logic in OptionManager.parse_args to use the right normalize_path*
function based on comma_separated_list value of the option.
2016-01-09 15:58:26 -06:00