简体   繁体   English

如何完全禁用对vscode上特定文件的linting?

[英]How to entirely disable linting on a specific file on vscode?

Visual studio code, with the python extension, offers code linting . 带有python扩展名的Visual Studio代码提供了代码linting While in the linked page it is documented how to generally enable/disable linting via user preferences, it is not clear if or how can I disable on a per file basis. 虽然在链接的页面中记录了如何通过用户首选项通常启用/禁用linting,但尚不清楚我是否或如何基于每个文件禁用。

More specifically, I'm looking for a way to disable linting on a file, preferably via command palette or similar. 更具体地说,我正在寻找一种方法,最好是通过命令面板或类似方法禁用文件的掉毛。

VS-code uses Pylint to lint Python code. VS代码使用Pylint整理Python代码。 Pylint (versions 0.26.1 and up) can be disabled for a specific file by adding # pylint: skip-file to the top of the page. 可以通过在页面顶部添加# pylint: skip-file来禁用特定文件的Pylint(0.26.1及更高版本)。

See the Pylint FAQs 请参阅Pylint常见问题解答

Modify this in settings.json file: 在settings.json文件中进行修改:

"python.linting.ignorePatterns": [
    ".vscode/*.py",
    "**{filename or pattern}**",
    "**/site-packages/**/*.py"
]

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

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