question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatically respect .pylintrc files in subdirectories

See original GitHub issue

Environment data

VS Code version: 1.19.0 Python Extension version: 0.9.0 (14 December 2017) Python Version: 3.6.1 OS and version: Windows 10 Home, Version 1703, OS-version 15063.483

Actual behavior

.pylintrc files in a directory in the workspace are not automatically found by pylint

Expected behavior

  • .pylintrc files found in a directory should be automatically respected for that folder and all sub-directories.
  • New .pylintrc files in sub-directories should take precedence over parent directories .pylintrc files

This is how it works when running the pylint command via terminal. .pylintrc files are automatically respected without supplying them specifically via the option --rcfile

Note that I am unsure if other options are respected as defined here https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options

Steps to reproduce:

  • Create a .pylintrc file in a directory in the workspace and notice how the rules defined are not respected

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:58
  • Comments:26 (2 by maintainers)

github_iconTop GitHub Comments

27reactions
JamesMessingercommented, May 17, 2018

I am also having this issue. However, I’ve been able to workaround it by using the python.linting.pylintArgs setting to explicitly point to the .pylintrc file

  "python.linting.pylintArgs": [
    "--rcfile",
    "${workspaceFolder}\\.pylintrc"
  ],

Btw… this issue seems related to https://github.com/DonJayamanne/pythonVSCode/issues/117

2reactions
mgasnercommented, May 19, 2022

This is surprising behavior! Especially in larger repositories or monorepos, it’s likely that different pylint standards will be applied to different parts of the directory tree or even to submodules. For example, you might want to enforce the existence of module-level docstrings in a library, but not in test files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically respect .pylintrc files in subdirectories #442
Expected behavior .pylintrc files found in a directory should be automatically respected for that folder and all sub-directories. New .pylintrc ...
Read more >
VSCode Python Linting .pylintrc in repository vs workspace root
I want the linter to use the file under the folder repo folder from where the .py file is opened. python · visual-studio-code...
Read more >
Pylint Documentation - Read the Docs
Pylint is a tool that checks for errors in Python code, tries to enforce a coding standard and looks for code smells. It....
Read more >
Running Pylint - Pylint 2.16.0-dev documentation
pylint --recursive=y mydir mymodule mypackage ... should always work since the current working directory is automatically added on top of the python path....
Read more >
Run Pylint for all Python files in a directory and all subdirectories
PYTHON : Run Pylint for all Python files in a directory and all subdirectories [ Gift : Animated Search Engine ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found