mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 18:46:52 +00:00
application: Keep unknown options in the unknown argument list
Positional arguments aren't necessary for determining where to load configuration anymore and is safe to keep both options and arguments to be forwarded for later parsing after configuration is loaded.
This commit is contained in:
parent
7f46990f4b
commit
2260f5362e
2 changed files with 2 additions and 7 deletions
|
|
@ -138,10 +138,7 @@ class Application(object):
|
|||
except ValueError:
|
||||
pass
|
||||
|
||||
opts, args = self.prelim_arg_parser.parse_known_args(args)
|
||||
# parse_known_args includes unknown options as args
|
||||
args = [a for a in args if not a.startswith("-")]
|
||||
return opts, args
|
||||
return self.prelim_arg_parser.parse_known_args(args)
|
||||
|
||||
def exit(self):
|
||||
# type: () -> None
|
||||
|
|
|
|||
|
|
@ -95,10 +95,8 @@ def test_prelim_opts_args(application):
|
|||
opts, args = application.parse_preliminary_options_and_args(
|
||||
['--foo', '--verbose', 'src', 'setup.py', '--statistics'])
|
||||
|
||||
assert not hasattr(opts, 'foo')
|
||||
assert not hasattr(opts, 'statistics')
|
||||
assert opts.verbose
|
||||
assert args == ['src', 'setup.py']
|
||||
assert args == ['--foo', 'src', 'setup.py', '--statistics']
|
||||
|
||||
|
||||
def test_prelim_opts_handles_empty(application):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue