VS Code 如何在测试文件中禁用 pydocstyle linting?
VS Code how to disable pydocstyle linting in testing files?
我目前正在做一个 python 项目,并决定安装 pydocstyle 来改善我的文档习惯。但是我不希望 pydocstyle 对我的测试文件进行 lint,并且想知道如何在 settings.json 中创建一个模式来实现这一点。谢谢
比如你的测试文件的前缀是test_
,你可以在Settings.json中添加如下代码:
"python.linting.ignorePatterns": [
"test_*.py",
]
然后您的测试文件被排除在 linting 之外:
终于找到了解决方案(但不要问我为什么它有效:)
"python.linting.pydocstyleArgs": ["--match=^((?!test).)*$"],
我目前正在做一个 python 项目,并决定安装 pydocstyle 来改善我的文档习惯。但是我不希望 pydocstyle 对我的测试文件进行 lint,并且想知道如何在 settings.json 中创建一个模式来实现这一点。谢谢
比如你的测试文件的前缀是test_
,你可以在Settings.json中添加如下代码:
"python.linting.ignorePatterns": [
"test_*.py",
]
然后您的测试文件被排除在 linting 之外:
终于找到了解决方案(但不要问我为什么它有效:)
"python.linting.pydocstyleArgs": ["--match=^((?!test).)*$"],