Normalize 'per-file-ignores' file paths

Leverage the `type` keyword argument to `ArgumentParser.add_option()` for
converting the raw string, either from a configuration file or the
command-line, into a data structure for later use.

Now with `OptionManager.parse_args()` feeding configuration file values
as default values to be considered by the `ArgumentParser.parse_args()`
framework, normalization of the file paths occur in single place.
This commit is contained in:
Eric N. Vander Weele 2019-08-28 15:27:51 -04:00
parent 8cd1e0ecc7
commit 31aad5975a
5 changed files with 33 additions and 23 deletions

View file

@ -94,14 +94,14 @@ per-file-ignores =
with tmpdir.as_cwd():
tmpdir.join('setup.cfg').write(setup_cfg)
_call_main(['.'], retv=1)
_call_main(['.'], retv=2)
out, err = capsys.readouterr()
assert out == '''\
There was a critical error during execution of Flake8:
Expected `per-file-ignores` to be a mapping from file exclude patterns to ignore codes.
assert err == '''\
usage: flake8 [options] file file ...
flake8: error: argument --per-file-ignores: Expected a mapping from file exclude patterns to ignore codes.
Configured `per-file-ignores` setting:
Found:
incorrect/*
values/*