Skip to content
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

Inline comments in the ignore section are being validated in setup.cfg #1750

Closed
thomasjpfan opened this issue Nov 23, 2022 · 1 comment
Closed
Labels

Comments

@thomasjpfan
Copy link

thomasjpfan commented Nov 23, 2022

how did you install flake8?

pip install flake8==6.0.0

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.10.8",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.10.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.0.0"
    }
  ],
  "version": "6.0.0"
}

Note I needed to remove the inline comment for flake8 --bug-report to not raise an error.

describe the problem

what I expected to happen

I expect no error when there are inline comments in the ignore section from setup.cfg

...

sample code

Given the following setup.cfg

# setup.cfg
[flake8]
max-line-length = 88
target-version = ['py38']
ignore=
    E24,   # check ignored by default in flake8. Meaning unclear.

commands ran

$ flake8 --version

With trackback:

Traceback (most recent call last):
  File "_/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "_/lib/python3.10/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "_/lib/python3.10/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "_/lib/python3.10/site-packages/flake8/main/application.py", line 186, in _run
    self.initialize(argv)
  File "_/lib/python3.10/site-packages/flake8/main/application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
  File "_/lib/python3.10/site-packages/flake8/options/parse_args.py", line 53, in parse_args
    opts = aggregator.aggregate_options(option_manager, cfg, cfg_dir, rest)
  File "_/lib/python3.10/site-packages/flake8/options/aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
  File "_/lib/python3.10/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}$'
@asottile
Copy link
Member

this was always happening -- the error is now pointing out that you were previously making a mistake since it was accidentally excluding things -- please read the flake8 configuration docs -- specifically the warning there

@PyCQA PyCQA locked as resolved and limited conversation to collaborators Nov 23, 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