简体   繁体   English

存储库与工作区根目录中的 VSCode Python Linting.pylintrc

[英]VSCode Python Linting .pylintrc in repository vs workspace root

I am trying to get pylint with vscode to respect.pylintrc placed in a repository.我正在尝试使用 vscode 获取 pylint 以 respect.pylintrc 放置在存储库中。 I had a look into the documentation of both pylint and vscode python extension.我查看了 pylint 和 vscode python 扩展的文档。 It doesn't seem possible.这似乎不可能。

Folder structure:文件夹结构:

Workspace-Root
    - Repository A
        - .pylintrc
        - src
            PYTHON SRC FILES
    - Repository B
        - .pylintrc
        - src
            PYTHON SRC FILES

We have currently +30 repositories from different teams.我们目前有来自不同团队的 +30 个存储库。 Is it somehow possible to configure the extension so that it will recognize the.pylintrc from the different projects without changing the workspace root to the repository folders?是否有可能以某种方式配置扩展,以便它可以识别来自不同项目的 the.pylintrc 而无需将工作区根目录更改为存储库文件夹? I want the linter to use the file under the folder repo folder from where the.py file is opened.我希望 linter 使用打开 .py 文件的文件夹 repo 文件夹下的文件。

You can specify a configuration file through rcfile option in the settings.json like this:您可以通过 settings.json 中的rcfile选项指定配置文件,如下所示:

"python.linting.pylintArgs": ["--rcfile=Repository A/.pylintrc"],

Or you can switch the linting cwd in the settings.json file like this:或者您可以在 settings.json 文件中切换 linting cwd,如下所示:

"python.linting.cwd": "c:\\Work\\python3.10\\Repository A",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM