PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
https://flake8.pycqa.org
Other
3.39k stars 306 forks source link

Config parser Failure With 7.1.0 #1947

Closed tbpassin closed 1 month ago

tbpassin commented 1 month ago

how did you install flake8?

py -m pip install --user flake8

unmodified output of flake8 --bug-report

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\__main__.py", line 7, in <module>
    raise SystemExit(main())
                     ^^^^^^
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\main\cli.py", line 23, in main
    app.run(argv)
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\main\application.py", line 198, in run
    self._run(argv)
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\main\application.py", line 186, in _run
    self.initialize(argv)
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\main\application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
                                 ^^^^^^^^^^^^^^^^
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\options\parse_args.py", line 53, in parse_args
    opts = aggregator.aggregate_options(option_manager, cfg, cfg_dir, rest)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\options\aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tom\AppData\Roaming\Python\Python312\site-packages\flake8\options\config.py", line 131, in parse_config
    raise ValueError(
ValueError: Error code '#' supplied to 'extend-ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'

describe the problem

what I expected to happen

Note that this is with Python 3.12. I expected to get an output not a traceback. I am not including a sample program because I get the same traceback as the --bug-report output when I try to check any file.

Debug suggestions

There are multiple problems in config.parse_config(). Many of the ones I found were in lines that used stack[-1] but stack was an empty list at this point so there was no "-1" element.

There was one line in system.cfg that consisted of a single indented "#" but I deleted it and nothing changed.

asottile commented 1 month ago

please search the issue tracker -- there are many duplicates about your specific error and the causes