【发布时间】:2022-10-24 09:49:57
【问题描述】:
我有插件 pylint。但我得到一些错误。像这个错误:
Missing module docstringPylint(C0114:missing-module-docstring)
这个错误:
Formatting a regular string which could be a f-stringPylint(C0209:consider-using-f-string)
这是我在 Visual Studio 代码中的 settings.json 文件:
"python.linting.enabled": true,
"python.linting.pylintArgs": [
"--disable=line-too-long",
"--disable=unused-argument",
"--disable=C0111",
"--errors-only"
],
这是发生错误的代码片段:
class Leg:
pass
class Back:
pass
class Chair:
def __init__(self, num_legs):
self.legs = [leg() for leg in range(num_legs)]
self.back = Back()
def __repr__(self):
return "I have {} and one back".format(len(self.legs))
print(Chair(5))
当然,我用谷歌搜索了这个。但是我在网上找到的建议是我必须如上所述更改 python.linting 的设置。但没有检测到任何变化。
而且我还重新启动了几次 vs code。
那么有人知道如何解决这个问题吗?
谢谢
【问题讨论】: