microsoft / vscode-pylint

Linting support for python using the pylint library.
https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
MIT License
70 stars 34 forks source link

.pylintrc not used #569

Closed ai-learner-00 closed 2 weeks ago

ai-learner-00 commented 3 weeks ago

Diagnostic Data

Behaviour

Expected Behavior

I added a .pylintrc to ignore the tests directory.

[MASTER]
ignore=tests

Actual Behavior

I still get warnings for a test file. image

I tried specifying the rcfile, but it didn't work.

                "pylint.enabled": true,
                "pylint.args": [
                    "--rcfile=.pylintrc"
                ],

Also, I tried "pylint.enabled": false to see if settings were used, and the warnings still appeared.

Reproduction Steps:

pyproject.zip

  1. Open the following code, which installs the pylint extension, in a dev container
  2. Go to test_postal_codes.py to see if there are warnings.

Logs:

Click here for detailed logs 2024-08-20 16:00:31.613 [info] [Trace - 4:00:31 PM] Sending request 'textDocument/codeAction - (27)'. 2024-08-20 16:00:31.613 [info] Params: { "textDocument": { "uri": "file:///workspaces/Service-GreatExpectations/tests/unit/custom_expectations/test_postal_codes.py" }, "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "context": { "diagnostics": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "message": "Missing module docstring", "code": "C0114:missing-module-docstring", "codeDescription": { "href": "https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/missing-module-docstring.html" }, "severity": 3, "source": "Pylint" }, { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 36 } }, "message": "Missing function or method docstring", "code": "C0116:missing-function-docstring", "codeDescription": { "href": "https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/missing-function-docstring.html" }, "severity": 3, "source": "Pylint" } ], "triggerKind": 2 } } 2024-08-20 16:00:31.625 [info] [Trace - 4:00:31 PM] Received response 'textDocument/codeAction - (27)' in 12ms. 2024-08-20 16:00:31.625 [info] Result: [] 2024-08-20 16:00:31.809 [info] [Trace - 4:00:31 PM] Sending request 'textDocument/codeAction - (28)'. 2024-08-20 16:00:31.809 [info] Params: { "textDocument": { "uri": "file:///workspaces/Service-GreatExpectations/tests/unit/custom_expectations/test_postal_codes.py" }, "range": { "start": { "line": 2, "character": 0 }, "end": { "line": 2, "character": 0 } }, "context": { "diagnostics": [], "triggerKind": 2 } } 2024-08-20 16:00:31.811 [info] [Trace - 4:00:31 PM] Received response 'textDocument/codeAction - (28)' in 2ms. 2024-08-20 16:00:31.811 [info] Result: [] 2024-08-20 16:00:32.500 [info] [Trace - 4:00:32 PM] Sending request 'textDocument/codeAction - (29)'. 2024-08-20 16:00:32.501 [info] Params: { "textDocument": { "uri": "file:///workspaces/Service-GreatExpectations/tests/unit/custom_expectations/test_postal_codes.py" }, "range": { "start": { "line": 1, "character": 35 }, "end": { "line": 1, "character": 35 } }, "context": { "diagnostics": [], "triggerKind": 2 } } 2024-08-20 16:00:32.502 [info] [Trace - 4:00:32 PM] Received response 'textDocument/codeAction - (29)' in 2ms. 2024-08-20 16:00:32.502 [info] Result: []

Outcome When Attempting Debugging Steps:

Did running it from the command line work? With pylint tests, there are no warnings.

Extra Details

karthiknadig commented 2 weeks ago

@ai-learner-00 This is because we explicitly ask for linting on a file. When you run pylint on a specific file, it does not use ignore. You can use pylint.ignorePatterns to tell the extension to not run linter on such files.

you can try this manually, run pylint tests\test_postal_codes.py and it should lint it. image