Skip to content

flake8 v6 only support 3 digits for a valid code #1759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Odelstad opened this issue Nov 24, 2022 · 2 comments
Closed

flake8 v6 only support 3 digits for a valid code #1759

Odelstad opened this issue Nov 24, 2022 · 2 comments
Labels

Comments

@Odelstad
Copy link

how did you install flake8?

pip install flake8
pip install flake8-pylint

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.8.10",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "flake8-pylint",
      "version": "0.1.3"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.10.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.0.0"
    }
  ],
  "version": "6.0.0"
}

describe the problem

what I expected to happen

I am using flake8-pylint to be able to run all checks in one command.

When I suppress pylint errors in INI file flake8 crashes.

I propose to change the regexp for a valid code to allow more than 3 digits.

sample code

t.py:

"""Docstring"""
print("{}".format(123))

sample ini file

[flake8]
ignore = PLC0209

commands ran

Without inifile

$ flake8 t.py
t.py:2:7: PLC0209 Formatting a regular string which could be a f-string (consider-using-f-string)

With ignore flag

$ flake8 --ignore PLC0209 t.py

With inifile

$ flake8 t.py
Traceback (most recent call last):
  File "/home/bug/venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/home/bug/venv/lib/python3.8/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/home/bug/venv/lib/python3.8/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/home/bug/venv/lib/python3.8/site-packages/flake8/main/application.py", line 186, in _run
    self.initialize(argv)
  File "/home/bug/venv/lib/python3.8/site-packages/flake8/main/application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
  File "/home/bug/venv/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 "/home/bug/venv/lib/python3.8/site-packages/flake8/options/aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
  File "/home/bug/venv/lib/python3.8/site-packages/flake8/options/config.py", line 131, in parse_config
    raise ValueError(
ValueError: Error code 'PLC0209' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'
@asottile
Copy link
Member

flake8 has never supported more than 3 digit codes and it was silently doing the wrong thing. now it is helpfully letting you know

@Odelstad
Copy link
Author

Ok, then we must leave flake8-pylint and use pylint explicitly.

@PyCQA PyCQA locked as resolved and limited conversation to collaborators Nov 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants