File tree 3 files changed +14
-6
lines changed
3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change
1
+ Fixed handling of ``--`` as separator between positional arguments and flags.
2
+ This was not actually fixed in 2.14.5.
3
+
4
+ Closes #7003, Refs #7096
Original file line number Diff line number Diff line change @@ -72,12 +72,17 @@ def _config_initialization(
72
72
# the configuration file
73
73
parsed_args_list = linter ._parse_command_line_configuration (args_list )
74
74
75
+ # Remove the positional arguments separator from the list of arguments if it exists
76
+ try :
77
+ parsed_args_list .remove ("--" )
78
+ except ValueError :
79
+ pass
80
+
75
81
# Check if there are any options that we do not recognize
76
82
unrecognized_options : list [str ] = []
77
83
for opt in parsed_args_list :
78
84
if opt .startswith ("--" ):
79
- if len (opt ) > 2 :
80
- unrecognized_options .append (opt [2 :])
85
+ unrecognized_options .append (opt [2 :])
81
86
elif opt .startswith ("-" ):
82
87
unrecognized_options .append (opt [1 :])
83
88
if unrecognized_options :
Original file line number Diff line number Diff line change @@ -148,11 +148,10 @@ def test_short_verbose(capsys: CaptureFixture) -> None:
148
148
assert "Using config file" in output .err
149
149
150
150
151
- def test_argument_separator (capsys : CaptureFixture ) -> None :
151
+ def test_argument_separator () -> None :
152
152
"""Check that we support using '--' to separate argument types.
153
153
154
154
Reported in https://github.com/PyCQA/pylint/issues/7003.
155
155
"""
156
- Run (["--" , str (EMPTY_MODULE )], exit = False )
157
- output = capsys .readouterr ()
158
- assert not output .err
156
+ runner = Run (["--" , str (EMPTY_MODULE )], exit = False )
157
+ assert not runner .linter .stats .by_msg
You can’t perform that action at this time.
0 commit comments