Commit graph

1769 commits

Author SHA1 Message Date
Eric N. Vander Weele
77b2506071 config: Switch code paths to use 'ConfigFileFinder.config_file'
Now that the `ConfigFileFinder` has the `.config_file` attribute, switch
the relevant code paths to utilize this public attribute.

Tests have been updated to either construct `ConfigFileFinder` or mock
the object appropriately.
2020-01-12 23:19:26 -05:00
Eric N. Vander Weele
153032f778 config: Add 'config_file' parameter to ConfigFileFinder
The `--config` flag is passed into `MergedConfigParser.parse()` and the
module-level function `config.get_local_plugins()`.  Since both of these
places utilize the `ConfigFileFinder` object and the configuration file
override pertains to how configuration behaves, this incremental change
directly associates the `ConfigFileFinder` and the configuration file
override.
2020-01-12 23:19:26 -05:00
Anthony Sottile
24c2693979 Merge branch 'config-remove-parent-tail-state' into 'master'
config: Remove ConfigFileFinder 'parent' and 'tail' attributes

See merge request pycqa/flake8!400
2020-01-13 04:17:23 +00:00
Anthony Sottile
8ac28d7d1d Merge branch 'config-finder-isolated-cleanup' into 'master'
application: Remove stale docstring param for `.find_plugins()`

See merge request pycqa/flake8!399
2020-01-13 04:15:13 +00:00
Eric N. Vander Weele
e887ef3317 config: Remove ConfigFileFinder 'parent' and 'tail' attributes
These attributes are only needed within the
`.generate_possible_local_files()` method.  Therefore, just obtain the
current working directory at the beginning of the method and reduce the
lifetime state of the `ConfigFileFinder` object.
2020-01-12 23:13:11 -05:00
Eric N. Vander Weele
98d3d50295 tests: Ensure patched os.getcwd() is an absolute path
`os.getcwd()` returns an absolute path; thus, the patched paths should
be absolute as well.

This is an incremental change towards removing the `ConfigFileFinder`
attributes `.parent` and `.tail` to be localized to
`.generate_possible_local_files()`.  Without this, the tests fail when
moving the patching because `os.path.abspath()` calls `os.getcwd()`,
expecting `os.getcwd()` to be an absolute path.
2020-01-12 23:13:04 -05:00
Eric N. Vander Weele
3010ab3fbd application: Remove stale docstring param for .find_plugins()
The 'ignore_config_files' parameter was accidentally not removed in
c918e72.
2020-01-12 15:19:07 -08:00
Anthony Sottile
a5aa81e875 Merge branch 'config-finder-isolated' into 'master'
Determine config isolation from the ConfigFileFinder object

See merge request pycqa/flake8!398
2020-01-08 17:50:57 +00:00
Eric N. Vander Weele
c918e72496 Remove unused 'isolated' parameter
Now that `ConfigFileFinder.ignore_config_files` attribute is used
everywhere and is constructed from the `--isolated` CLI option, the now
unused `isolated` parameters can be safely removed.
2020-01-07 13:14:34 -05:00
Eric N. Vander Weele
3d546d448a config: Switch code paths to use 'ConfigFileFinder.ignore_config_files'
Now that the `ConfigFileFinder` has the `.ignore_config_files`
attribute, switch the relevant code paths to utilize this public
attribute.

Tests have been updated to either construct `ConfigFileFinder` or mock
the object appropriately.
2020-01-07 13:03:34 -05:00
Eric N. Vander Weele
a5c17c1a19 config: Add 'ignore_config_files' parameter to ConfigFileFinder
The `--isolated` flag is passed into `MergedConfigParser.parse()` and
the module-level function `config.get_local_plugins()`.  Since both of
these places utilize the `ConfigFileFinder` object and isolation
pertains to how the `ConfigFileFinder` should behave with respect to
isolation, this incremental change more directly associates the
`ConfigFileFinder` and configuration file isolate.
2020-01-07 12:54:47 -05:00
Anthony Sottile
4395b05605 Merge branch 'config-read-varargs' into 'master'
config: Change ConfigFileFinder._read_config() to accept variadic args

See merge request pycqa/flake8!397
2020-01-07 03:26:26 +00:00
Eric N. Vander Weele
1a4060cd5f config: Change ConfigFileFinder._read_config() to accept variadic args
This simplifies `._read_config()` by removing a conditional branch in
the situation where it is called with one file to process.  Now the
contract accepts any number of arguments of the same type.

Where callers invoke `._read_config()` with a `Sequence`, the call site
has been changed to unpack arguments (i.e., `*`).

The tests in `test_merged_config_parser.py` needed to return a string
for the user configuration path instead of an empty list since
`ConfigFileFinder.user_config_file()` returns a string.
2020-01-06 22:23:12 -05:00
Anthony Sottile
20906d4304 Merge branch 'aggregator-config-isolated-fix' into 'master'
aggregator: Forward  --config and --isolated options during aggregation

Closes #605

See merge request pycqa/flake8!395
2019-12-30 00:20:42 +00:00
Eric N. Vander Weele
738c8490ec tests: Add integration tests for --config and --isolated
Prevent regressions by adding integration tests to ensure that these
options are passed through to `aggregator.aggregate_options()`.
2019-12-29 19:17:31 -05:00
Eric N. Vander Weele
7f9f70064c aggregator: Forward --config and --isolated options during aggregation
This fixes a regression introduced in !346 to ensure that `--config` and
`--isolated` are recognized in `aggregate_options()`.

The regression manifested because `aggregate_options()` was relying on
re-parsing `argv` to obtain the option values.  However, !346 changed
the preliminary parsing logic to only parse and "eat" what is necessary
and forward along the options needed before all the configuration was
loaded.  This code path was overlooked because the tests in
`test_aggregator()` were passing but the call from the `Application`
object would never have these options in the remaining `argv` list to be
passed long.
2019-12-29 18:07:51 -05:00
Anthony Sottile
bb61b3df82 Merge branch 'app-remove-make-config-finder' into 'master'
application: Inline creation of config.ConfigFileFinder

See merge request pycqa/flake8!393
2019-12-03 18:25:50 +00:00
Eric N. Vander Weele
9fa5663986 application: Inline creation of config.ConfigFileFinder
Simplify the initialization code path by invoking
`config.ConfigFileFinder` directly instead of the extra hop by calling
the static class-level `Application.make_config_finder()` method.
2019-12-03 13:21:01 -05:00
Anthony Sottile
21d2adf21f Merge branch 'fix/disable_noqa' into 'master'
`--disable-noqa` does not override `# flake8: noqa`

Closes #590

See merge request pycqa/flake8!380
2019-12-03 17:45:45 +00:00
Anthony Sottile
2ab681a4be Merge branch 'typo' into 'master'
Fix typos

See merge request pycqa/flake8!392
2019-12-02 15:38:48 +00:00
Brian Wignall
591a230940 Fix typos 2019-12-02 15:38:48 +00:00
Anthony Sottile
1062be2643 Merge branch 'fix/exit-zero' into 'master'
Fix --exit-zero when --diff is empty

See merge request pycqa/flake8!391
2019-12-02 06:25:27 +00:00
Kinya TERASAKA
cc037338df Fixes --exit-zero when empty --diff
fixes pycqa/flake8/merge_requests!137
2019-12-02 13:47:15 +09:00
Anthony Sottile
d99fd24ec5 Merge branch 'test_pypy' into 'master'
Test pypy in gitlab CI

See merge request pycqa/flake8!390
2019-11-29 18:30:15 +00:00
Anthony Sottile
8fdf262399 Test pypy in gitlab CI 2019-11-29 10:26:48 -08:00
Anthony Sottile
22f44c3d1a Merge branch 'workaround_pypy_repr_recursion_error' into 'master'
Work around RecursionError in EntryPoint.__repr__ in pypy

See merge request pycqa/flake8!389
2019-11-29 18:21:15 +00:00
Anthony Sottile
6b764d0ec7 Work around RecursionError in EntryPoint.__repr__ in pypy
https://gitlab.com/python-devs/importlib_metadata/issues/97
2019-11-29 10:17:29 -08:00
Anthony Sottile
5d7eeaa9b3 Merge branch 'importlib_metadata' into 'master'
Switch from entrypoints to importlib_metadata

Closes #569

See merge request pycqa/flake8!388
2019-11-29 17:40:55 +00:00
Anthony Sottile
d3c95f00d0 Switch from entrypoints to importlib_metadata 2019-11-28 17:30:52 -08:00
Anthony Sottile
15de413f9e Merge branch 'app-cleanup-docstrings' into 'master'
application: Update find_plugins() docstring

See merge request pycqa/flake8!387
2019-11-27 17:01:37 +00:00
Anthony Sottile
e891d5b00a Merge branch 'app-remove-local-plugin-attr' into 'master'
application: Remove local plugins state

See merge request pycqa/flake8!386
2019-11-27 17:00:24 +00:00
Eric N. Vander Weele
af9153d397 application: Update find_plugins() docstring
When the checks for the cached objects were removed in
2d5eae637a, the `.find_plugins()`
docstring need to be updated to specify the updated behavior.
2019-11-27 11:52:26 -05:00
Eric N. Vander Weele
131b063cb2 application: Remove local plugins state
The `.local_plugins` attribute can be removed from the `Application`
since the usage of the `LocalPlugins` object is isolated to the
`.find_plugins()` method.
2019-11-27 11:13:26 -05:00
Anthony Sottile
e571167161 Merge branch 'application-remove-config-finder-state' into 'master'
application: Remove configuration finder state

See merge request pycqa/flake8!384
2019-11-22 16:16:35 +00:00
Eric N. Vander Weele
594c16abb4 application: Remove configuration finder state
This change removes the `.config_finder` object from the `Application`.
Since the configuration finder is only needed during initialization, we
constrain the finder to be returned and passed to other methods
necessary for initialization.
2019-11-22 11:04:40 -05:00
Anthony Sottile
c9209507a8 Merge branch 'pytest-avoid-5.2.3' into 'master'
tox: Avoid installing pytest==5.2.3 due to an introduced regression

Closes #594

See merge request pycqa/flake8!383
2019-11-15 14:57:29 +00:00
Eric N. Vander Weele
03ee3644dd tox: Avoid installing pytest==5.2.3 due to an introduced regression
This will ensure that others don't git bitten by accidentally picking up
`pytest==5.2.3`.

See https://github.com/pytest-dev/pytest/issues/6194.
2019-11-15 20:53:03 +09:00
Isac Yoo
3b80b2e05a
Remove redundant sample data 2019-11-13 11:58:49 +09:00
Anthony Sottile
e653ab8062 Merge branch 'app-make-config-side-effect-free' into 'master'
application: Change `make_config_finder` to be a pure static method

See merge request pycqa/flake8!378
2019-11-06 04:35:22 +00:00
Eric N. Vander Weele
d75088b199 application: Change make_config_finder to be a pure static method
This change makes `Application.make_config_finder` to be side-effect
free where it its return value is only determined by its input values.
2019-11-06 12:18:15 +08:00
Byeonghoon Yoo
705c16a268
Fix codes 2019-11-06 00:28:09 +09:00
Anthony Sottile
034f8823bc Merge branch 'app-remove-cached-objects' into 'master'
application: Remove checks for properties being set previously

See merge request pycqa/flake8!379
2019-11-05 13:43:45 +00:00
Anthony Sottile
02c6091b27 Merge branch 'py38' into 'master'
Cleanup CI and add python 3.8 support

See merge request pycqa/flake8!377
2019-11-05 13:41:41 +00:00
Byeonghoon Yoo
d23f77d06e
Fix lint error 2019-11-05 22:16:18 +09:00
Byeonghoon Yoo
29d8b11209
Add unit test for dd411e95 2019-11-05 22:00:05 +09:00
Byeonghoon Yoo
dd411e95bc
Fix should_ignore_file() to handle disable-noqa configuration 2019-11-05 21:59:19 +09:00
Byeonghoon Yoo
9a45593aae
Add disable_noqa attribute to FileProcessor 2019-11-05 21:54:24 +09:00
Djailla
f2a17ddf33 Cleanup CI and add python 3.8 support 2019-11-05 10:52:55 +01:00
Eric N. Vander Weele
2d5eae637a application: Remove checks for properties being set previously
Remove the checks to see an object was already created before creating
or obtaining it.  This is not necessary as each entire run of `flake8`
calls these methods *only* once.
2019-11-05 15:32:51 +08:00
Anthony Sottile
19868e5c21 Merge branch 'aggregate_options-simplify-function-definition' into 'master'
aggregator: Simplify 'aggregate_options' function definition

See merge request pycqa/flake8!376
2019-11-03 01:11:43 +00:00