Commit graph

2256 commits

Author SHA1 Message Date
Anthony Sottile
a649019c2e Merge branch 'type-config-file-finder' into 'master'
Add typings to ConfigFileFinder constructor

See merge request pycqa/flake8!346
2019-08-29 20:40:41 +00:00
Eric N. Vander Weele
c2216c0ddf Add typings to ConfigFileFinder constructor
`OptionManager.parse_known_args()` is guaranteed to return a list of
remaining argument strings.
2019-08-29 16:36:47 -04:00
Anthony Sottile
5144196abd Do not pass noqa to plugins, have flake8 decide whether to report 2019-08-29 13:14:12 -07:00
Anthony Sottile
45ad2faf8f Merge branch 'hoist-argv' into 'master'
Hoist passing through sys.argv at the CLI layer

See merge request pycqa/flake8!345
2019-08-29 20:09:47 +00:00
Eric N. Vander Weele
cf4bc53c12 Hoist passing through sys.argv at the CLI layer
`flake8.main.cli.main()` is the primary entry point for the command-line
implementation of flake8 (invoked via `__main__` or `console_scripts`).
Therefore, it is reasonable for the entry point to be responsible for
obtaining command line arguments from `sys.argv` there.

Note that `sys.argv[1:]` is necessary in order to strip off the script
name.  Formerly, this was not needed in
`Application.parse_preliminary_options_and_args()`, which was using
`sys.argv[:]` because the result of the argument parsing was just for
determining additional configuration to be loaded.  Then, the *real* CLI
argument parsing was forwarding the original `None` value to
`argparse.ArgumentParser.parse_args()`, which internally was obtaining
arguments as `sys.argv[1:]`.

Additionally, the contract for various argument parsing methods to be
guaranteed a `List[str]`.
2019-08-29 16:06:02 -04:00
Anthony Sottile
8b34b334fa Merge branch 'revert-6a70aaae' into 'master'
Revert "Merge branch 'hoist-argv' into 'master'"

See merge request pycqa/flake8!344
2019-08-28 23:21:04 +00:00
Anthony Sottile
b41d983f04 Revert "Merge branch 'hoist-argv' into 'master'"
This reverts merge request !343
2019-08-28 23:16:20 +00:00
Anthony Sottile
6a70aaae7f Merge branch 'hoist-argv' into 'master'
Hoist passing through sys.argv at the CLI layer

See merge request pycqa/flake8!343
2019-08-28 23:08:45 +00:00
Eric N. Vander Weele
50ac2f7237 Hoist passing through sys.argv at the CLI layer
`flake8.main.cli.main()` is the primary entry point for the command-line
implementation of flake8 (invoked via `__main__` or `console_scripts`).
Therefore, it is reasonable for the entry point to be responsible for
obtaining command line arguments from `sys.argv` there.

Additionally, the contract for various argument parsing methods to be
guaranteed a `List[str]`.
2019-08-28 17:51:33 -04:00
Anthony Sottile
7708e5b4ab Merge branch 'plugin_argparse_groups' into 'master'
Put plugin options into separate argparse groups

Closes #565

See merge request pycqa/flake8!342
2019-08-19 23:13:54 +00:00
Anthony Sottile
8fd36ba15b Put plugin options into separate argparse groups 2019-08-19 15:58:34 -07:00
Anthony Sottile
f265b2275b Merge branch 'argparse' into 'master'
move from optparse to argparse

See merge request pycqa/flake8!341
2019-08-18 22:08:13 +00:00
Anthony Sottile
76515bbb8e Apply suggestion to src/flake8/formatting/base.py 2019-08-18 22:05:00 +00:00
Anthony Sottile
b66ebd7034 move from optparse to argparse 2019-08-17 20:09:45 -07:00
Anthony Sottile
9c18aaedb4 Merge branch 'fix_travis2' into 'master'
Fix travis-ci

See merge request pycqa/flake8!340
2019-08-11 00:08:36 +00:00
Anthony Sottile
554e91fdb0 Fix travis-ci 2019-08-10 13:14:52 -07:00
Anthony Sottile
03cb85f556 Merge branch 'show_source_with_tabs' into 'master'
Fix --show-source when indented with tabs

Closes #563

See merge request pycqa/flake8!339
2019-08-10 18:44:04 +00:00
Anthony Sottile
e8c79dcd33 Fix --show-source when indented with tabs 2019-08-10 11:37:01 -07:00
Anthony Sottile
d43d498d41 Merge branch 'doc_conf_priority' into 'master'
Document priority of configuration files and command line

Closes #560

See merge request pycqa/flake8!336
2019-08-07 13:00:58 +00:00
peterjc
9e97143e49 Document priority of configuration files and command line
Closes issue 560.
2019-08-07 10:31:14 +01:00
Anthony Sottile
d9a4547487 Merge branch 'remove_pydocstyle_workaround' into 'master'
Remove workaround for broken pydocstyle / flake8-docstrings

See merge request pycqa/flake8!335
2019-08-02 18:05:57 +00:00
Anthony Sottile
3d1069a397 Remove workaround for broken pydocstyle / flake8-docstrings 2019-08-02 10:57:15 -07:00
Anthony Sottile
4b7208936a Merge branch 'deprecate_setuptools_command' into 'master'
Deprecate the flake8 setuptools integration

Closes #544

See merge request pycqa/flake8!330
2019-08-01 21:26:24 +00:00
Anthony Sottile
e8de432f8e Merge branch 'simplify-normalize-paths' into 'master'
Hoist comma-separated string parsing out of path normalization

See merge request pycqa/flake8!334
2019-07-28 14:48:47 +00: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
f01011a403 Normalize option values additionally by type
Now that the contract has narrowed for `utils.normalize_paths()`
and `utils.parse_comma_separated_list()`, `Option.normalize()` must
handle when the option value is either a singular value or a sequence
(i.e., `list`) of values.

The paths where `Option.normalize()` is called are:

1. options/config.py: `MergedConfigParser.parse_*_config()`
    There are 3 paths wehre eventually `_normalize_value()` is called.
2. options/manager.py: `OptionManager.parse_args()`

For (1), values are coming from the `configparser` module.  For (2),
values are coming from `optparse.OptionParser`.

Rudimentary investigation seems to implicate that
`optparse.OptionParser.parse_args()` always returns values in a `list`
because it accumulates values.  However, for `configparser`, the values
are a string due to the key-value nature of the INI format.

Given that `Option.normalize()` is the convergence point where
normalization of an option occurs, it is acceptable for the method to
also handle the parsing comma-separated values and path normalization by
the option value's type.
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
a0cd55fd6d utils: Assert desired contract for normalize_paths()
This is a separate commit so it can be dropped during a rebase or revert
independently.
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
Eric N. Vander Weele
9fbaf2d2ea utils: Assert desired contract for parse_comma_separated_list()
This is a separate commit so it can be dropped during a rebase or
reverted independently.
2019-07-28 10:39:27 -04:00
Anthony Sottile
862b17d229 Merge branch 'extra-config-normalization' into 'master'
Push down extra config file path normalization into main config handling

See merge request pycqa/flake8!333
2019-07-23 04:29:28 +00:00
Eric N. Vander Weele
95f26d7fe9 Push down extra config file path normalization into main config handling
Move the path normalization for extra configuration file paths down into
the main `config` module where other path normalization occurs.

This also guarantees that the call to `utils.normalize_paths()` is given
a sequence, instead of a potential `None` value.
2019-07-22 21:29:24 -04:00
Anthony Sottile
ace069c9c3 Merge branch 'F633' into 'master'
Fix incorrect error string in documentation

See merge request pycqa/flake8!332
2019-07-19 23:05:31 +00:00
Markus Gerstel
ce26d89cbf
Fix incorrect error string in documentation
In merge request !300 the description of F631 was accidentally used for
F633.
2019-07-19 23:56:05 +01:00
Anthony Sottile
77abc11a6f Deprecate the flake8 setuptools integration 2019-07-08 15:22:51 -07:00
Anthony Sottile
4a52c99cde Merge branch 'fix_appveyor' into 'master'
Fix / improve recently merged patches + CI

See merge request pycqa/flake8!329
2019-07-08 21:57:21 +00:00
Anthony Sottile
d4b0073167 Fix / improve recently merged patches + CI 2019-07-08 14:22:51 -07:00
Anthony Sottile
f00d483ea5 Merge branch 'dev' into 'master'
Move setup metadata to setup.cfg

Closes #487

See merge request pycqa/flake8!325
2019-07-08 20:14:44 +00:00
Surya Teja
3397a94a10 Move setup metadata to setup.cfg 2019-07-08 20:14:44 +00:00
Anthony Sottile
65262dc597 Merge branch 'extend-exclude' into 'master'
support extend-exclude Fixes #535

Closes #535

See merge request pycqa/flake8!315
2019-07-08 20:12:47 +00:00
Thomas Grainger
9ba6677c4a support extend-exclude Fixes #535 2019-07-08 20:12:47 +00: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
aa792d2930 Release 3.7.8 2019-07-08 11:21:04 -07:00
Anthony Sottile
f41e87bf37 Merge branch 'pyflake-normalize-path' into 'master'
pyflakes: Change to `normalize_path()` for filename normalization

See merge request pycqa/flake8!327
2019-07-08 17:04:02 +00:00
Eric N. Vander Weele
24e8b8163c pyflakes: Change to normalize_path() for filename normalization
It's unnecessary to call the `normalize_paths()` function because it is
intended for dealing with multiple paths to normalize.  Given that
`normalize_paths()` utilizes `normalize_path()`, just call
`normalize_path()` directly.
2019-07-08 09:58:24 -07:00
Anthony Sottile
d6bf438e44 Merge branch 'fix_linters' into 'master'
fix CI build

See merge request pycqa/flake8!328
2019-07-08 16:14:15 +00:00
Anthony Sottile
7506847c9a fix CI build 2019-07-08 09:07:37 -07:00
Anthony Sottile
076dfeee37 Merge branch 'patch-1' into 'master'
Identify error codes with more than one letter in noqa-flags correctly

Closes #549

See merge request pycqa/flake8!326
2019-06-16 17:17:46 +00:00
Markus Piotrowski
37964dbd84 Update test_violation.py
Added tests to check if long error codes are correctly identified.
2019-06-16 17:02:54 +00:00
Markus Piotrowski
0ac337608b This PR addresses issue #549 (noqa does only work as intended with single letter error codes). A single change in the regex NOQA_INLINE_REGEXP in defaults.py will allow to catch error codes which consist of more than one letter.
This will close #549.
2019-06-16 15:55:37 +00:00