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

Issue with parsing comments in flake8 config #1753

Closed
vinitkumar opened this issue Nov 24, 2022 · 1 comment
Closed

Issue with parsing comments in flake8 config #1753

vinitkumar opened this issue Nov 24, 2022 · 1 comment
Labels

Comments

@vinitkumar
Copy link

how did you install flake8?

pip install --upgrade flake8



Requirement already satisfied: flake8 in ./venv/lib/python3.10/site-packages (5.0.4)
Collecting flake8
  Downloading flake8-6.0.0-py2.py3-none-any.whl (57 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.8/57.8 kB 2.4 MB/s eta 0:00:00
Requirement already satisfied: flake8-bugbear in ./venv/lib/python3.10/site-packages (22.10.27)


### unmodified output of `flake8 --bug-report`

```json
{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.10.2",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "flake8-bugbear",
      "version": "22.10.27"
    },
    {
      "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

diff --git a/setup.cfg b/setup.cfg
index 5948cc21..3cc6eeea 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -25,11 +25,11 @@ ignore =
     W504,
     F403,
     B007,
-    F401, # ignore unused imports for now and fix the real issues
+    F401,
     B950,
-    W605, # regex related warnings
+    W605,
     W503,
-    N806, # variable naming in django inside function might not be lowercase, since we can also use class name import
+    N806,

My flake8 config in setup.cfg had comments to explain some of the rules. They worked in all previous version of flake8. However, with this latest version, I had to comment this out for flake8 to work, or I will just get a crash like this:

Traceback (most recent call last):
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/lib/python3.10/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/lib/python3.10/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/lib/python3.10/site-packages/flake8/main/application.py", line 186, in _run
    self.initialize(argv)
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/lib/python3.10/site-packages/flake8/main/application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/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 "/Users/vinitkumar/projects/python/socialschools-intranet/venv/lib/python3.10/site-packages/flake8/options/aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
  File "/Users/vinitkumar/projects/python/socialschools-intranet/venv/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}$'

It looks like the support for comments in flake8 config is deprecated, or maybe it is a regression.

@asottile
Copy link
Member

please search the issue tracker next time #1750 -- or read the changelog or the flake8 configuration docs

@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