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

Support the "Info" category for flake8 #1438

Closed
remcohaszing opened this issue Apr 19, 2018 · 7 comments
Closed

Support the "Info" category for flake8 #1438

remcohaszing opened this issue Apr 19, 2018 · 7 comments
Labels
area-editor-* User-facing catch-all area-linting feature-request Request for new features or functionality needs PR Ready to be worked on

Comments

@remcohaszing
Copy link

Environment data

  • VS Code version: 1.22.2
  • Extension version: 2018.3.1
  • OS and version: Ubuntu 17.10
  • Python version: 3.6
  • Type of virtual environment used: N/A
  • Relevant/affected Python packages and their versions: flake8==3.5.0 flake8-import-order==0.17.1

Actual behavior

Flake8 plugin configuration settings don’t match the settings schema in vscode, even though the settings do work.

Expected behavior

Flake8 plugin settings are not marked as unknown in the vscode settings file.

Steps to reproduce:

  1. Install flake8

  2. Install flake8-import-order

  3. Open a file with the following contents:

    from foo import bar
    
    import sys
  4. Notice how this triggers an info level problem

  5. Add this line to your vscode settings:

      "python.linting.flake8CategorySeverity.I": "Warning",
  6. Notice this gives a warning in the settings file

  7. Save or reopen the Python file

  8. Notice that the severity level has changed from info to warning

Logs

N/A

@brettcannon brettcannon changed the title Flake8 plugin settings work, but trigger a warning in vscode settings Flake8 plugin settings work, but trigger a warning in vscode settings.json Apr 19, 2018
@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug needs verification area-formatting labels Apr 19, 2018
@brettcannon brettcannon changed the title Flake8 plugin settings work, but trigger a warning in vscode settings.json Support the "Info" category for flake8 May 7, 2018
@brettcannon brettcannon added feature-request Request for new features or functionality area-linting needs decision and removed area-formatting needs verification bug Issue identified by VS Code Team member as probable bug labels May 7, 2018
@brettcannon
Copy link
Member

We should come up with a flexible mechanism for classifying flake8 issues/categories so that we can cover this need as well as any other future categories a plug-in might add.

Idea I head was a dict whose keys get put into a trie which we can the use to find the specified category or issue's classification.

@MetRonnie
Copy link

This ought to work if the flake8 plugin uses more than 1 letter for the prefix, e.g. flake8-simplify uses SIM, but

"python.linting.flake8CategorySeverity.SIM": "Warning",

does not work (you have to use .S instead)

@gschwaer
Copy link

Similar case for [flake8-]darglint. Flake8 is called with:

/usr/bin/python -m flake8 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s ~/path/to/file.py

thus generates

44,1,D,DAR101:Missing parameter(s) in Docstring: - name

In case someone has the same issue: Put the following in the settings to remap these to errors:

"python.linting.flake8CategorySeverity.D": "Error", // remapping of darglint errors to proper vscode errors

But of course, if you have another flake-8 plugin that generates error codes starting with D, this will remap them as well.

@Avasam
Copy link

Avasam commented Aug 24, 2022

This ought to work if the flake8 plugin uses more than 1 letter for the prefix, e.g. flake8-simplify uses SIM, but

"python.linting.flake8CategorySeverity.SIM": "Warning",

does not work (you have to use .S instead)

To extend on this, I would like to be able to do

  "python.linting.flake8CategorySeverity.SIM": "Warning",
  "python.linting.flake8CategorySeverity.SIM9": "Information",

@karthiknadig
Copy link
Member

Please try the flake8 extension, currently in pre-release. We are looking for feedback on it, please create issues on github for the extension: https://marketplace.visualstudio.com/items?itemName=ms-python.flake8 . This will be the eventual successor for the flake8 linting support in the extension.

One of the things you can do there is customize the severity, by individual error codes or categories.

@karthiknadig
Copy link
Member

Closing this, since we have begun to process to migrate users over to flake8 extension. Plese try it out: https://marketplace.visualstudio.com/items?itemName=ms-python.flake8

@Avasam
Copy link

Avasam commented Nov 8, 2022

Relevant equivalent issue on the new repo. In case anyone comes across this. Go there instead: microsoft/vscode-flake8#7

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all area-linting feature-request Request for new features or functionality needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

8 participants