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

Have a default set of linting rules #554

Closed
brettcannon opened this issue Jan 9, 2018 · 3 comments
Closed

Have a default set of linting rules #554

brettcannon opened this issue Jan 9, 2018 · 3 comments
Assignees
Labels
area-linting feature-request Request for new features or functionality
Milestone

Comments

@brettcannon
Copy link
Member

The default rules for most linters like pylint are rather broad and thus can be annoying if you only want squiggles for basic stuff like unused variables (e.g. not everyone wants to be told what an appropriate variable name is). When the user doesn't provide any specific linting configuration -- whether through a config file or through their settings.json -- we should provide a default experience that works for the vast majority of users to keep them from being overwhelmed.

@brettcannon
Copy link
Member Author

brettcannon commented Jan 10, 2018

Our current thinking is to enable all F and E messages (fatal and error, respectively), and the following warnings:

  • unreachable (W0101): Unreachable code
  • duplicate-key (W0109): Duplicate key %r in dictionary
  • unnecessary-semicolon (W0301): Unnecessary semicolon
  • global-variable-not-assigned (W0602): Using global for %r but no assignment is done
  • unused-variable (W0612): Unused variable %r
  • binary-op-exception (W0711): Exception to catch is the result of a binary "%s" operation
  • bad-format-string (W1302): Invalid format string
  • anomalous-backslash-in-string (W1401): Anomalous backslash in string
  • bad-open-mode (W1501): "%s" is not a valid mode for open

The --enable flag to Pylint should make this straightforward in that regard, e.g. --enable=F,E,W0602,....

@brettcannon
Copy link
Member Author

brettcannon commented Jan 16, 2018

Here are the settings I have in my own settings.json to make the proposal work:

"python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    // Unnecessary once https://github.com/Microsoft/vscode-python/issues/554 is fixed.
    "python.linting.pylintArgs": [
        "--disable=all",
        "--enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode"
    ]

@MikhailArkhipov
Copy link

df39217

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-linting feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants