Flake8 Error code '#' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'
Asked Answered
R

1

25

I met this issue while running git push.

$ flake8 --config setup.cfg Traceback (most recent call last):   File "/usr/local/bin/flake8", line 8, in <module>
    sys.exit(main())   File "/usr/local/lib/python3.8/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)   File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)   File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 186, in _run
    self.initialize(argv)   File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)   File "/usr/local/lib/python3.8/site-packages/flake8/options/parse_args.py", line 53, in parse_args
    opts = aggregator.aggregate_options(option_manager, cfg, cfg_dir, rest)   File "/usr/local/lib/python3.8/site-packages/flake8/options/aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)   File "/usr/local/lib/python3.8/site-packages/flake8/options/config.py", line 131, in parse_config
    raise ValueError( ValueError: Error code '#' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'
Ritual answered 24/11, 2022 at 9:40 Comment(0)
R
49

If you encounter the issue of flake8, please revise your setup.cfg as the following. This issue was caused by the updating of flake8 from 5 to 6.

enter image description here

Ritual answered 24/11, 2022 at 9:40 Comment(2)
In my case, this problem came from the nbqa-flake8 pre-commit check, which automatically upgraded the flake8 version. I have solved it by providing an earlier version as an additional dependency in the .pre-commit-config.yaml: additional_dependencies: [flake8==3.8.4]Peradventure
In my venv installation with python 3.10.9 and flak8 version 6.0.0, I found this in the file .flake8 beside venv/.Propagate

© 2022 - 2024 — McMap. All rights reserved.