diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 5e61fb0..8290068 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -116,21 +116,7 @@ class Application(object): :rtype: (argparse.Namespace, list) """ - # We haven't found or registered our plugins yet, so let's defer - # printing the version until we aggregate options from config files - # and the command-line. First, let's clone our arguments on the CLI, - # then we'll attempt to remove ``--version`` so that we can avoid - # triggering the "version" action in argparse. If it's not there, we - # do not need to worry and we can continue. If it is, we successfully - # defer printing the version until just a little bit later. - # Similarly we have to defer printing the help text until later. - args = argv[:] - try: - args.remove("--version") - except ValueError: - pass - - return self.prelim_arg_parser.parse_known_args(args) + return self.prelim_arg_parser.parse_known_args(argv) def exit(self): # type: () -> None diff --git a/tests/unit/test_application.py b/tests/unit/test_application.py index a3d9bba..9d4debc 100644 --- a/tests/unit/test_application.py +++ b/tests/unit/test_application.py @@ -93,10 +93,10 @@ def test_returns_specified_plugin(application): def test_prelim_opts_args(application): """Verify we get sensible prelim opts and args.""" opts, args = application.parse_preliminary_options_and_args( - ['--foo', '--verbose', 'src', 'setup.py', '--statistics']) + ['--foo', '--verbose', 'src', 'setup.py', '--statistics', '--version']) assert opts.verbose - assert args == ['--foo', 'src', 'setup.py', '--statistics'] + assert args == ['--foo', 'src', 'setup.py', '--statistics', '--version'] def test_prelim_opts_ignore_help(application):