summaryrefslogtreecommitdiff
path: root/src/flake8/main
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2020-05-11 23:43:39 -0400
committerAnthony Sottile <asottile@umich.edu>2020-05-11 22:17:52 -0700
commite6d8a90e5d6e9f3156a4adfcdb65a9fb1d12788f (patch)
treef1e7b606906bb9bf4cacb1f65caad3621a7bcd08 /src/flake8/main
parentb4d285019210ccdb5d526e64c281db64e5316d6c (diff)
downloadflake8-e6d8a90e5d6e9f3156a4adfcdb65a9fb1d12788f.tar.gz
options: Forward `--output-file` to be reparsed for BaseFormatter
This fixes a regression introduced in daca2c8 and b14d47b. The --output-file` option was consumed by the preliminary option parser. However, the `BaseFormatter` class needs the option for setting the output filename. This special cases this option to ensure it gets re-parsed and respected when specified on the CLI.
Diffstat (limited to 'src/flake8/main')
-rw-r--r--src/flake8/main/application.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py
index 001ad6c..e4b7930 100644
--- a/src/flake8/main/application.py
+++ b/src/flake8/main/application.py
@@ -112,7 +112,12 @@ class Application(object):
:rtype:
(argparse.Namespace, list)
"""
- return self.prelim_arg_parser.parse_known_args(argv)
+ args, rest = self.prelim_arg_parser.parse_known_args(argv)
+ # XXX (ericvw): Special case "forwarding" the output file option so
+ # that it can be reparsed again for the BaseFormatter.filename.
+ if args.output_file:
+ rest.extend(("--output-file", args.output_file))
+ return args, rest
def exit(self):
# type: () -> None