VSCode pylint 没有突出显示未使用的参数
VSCode pylint not highlighting unused arguments
我有以下方法
def foo(bar):
print("hello world")
编辑:运行 VSCode
中的 pylint
[预期行为]
pylint 将 'bar' 突出显示为未使用的变量
[实际行为]
从VScode输出
##########Linting Output - pylint##########
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
我没有额外的 pylint 配置设置
事实证明 VSCode 中有一个设置强制执行最少的检查程序
Python › Linting: Pylint Use Minimal Checkers
我在 pylint documentation 中找到了这个:
possibly-unused-variable (W0641):
Possibly unused variable %r Used when a variable is defined but might not be used. The possibility comes from the fact that locals() might be used, which could consume or not the said variable
在你的情况下,可能是因为你没有在你的函数中使用 bar
参数。如果您不使用它,只需将其删除以获取清洁代码。
如果您想更改此设置,请查看关于 linting 的官方 VS Code documentation。
我有以下方法
def foo(bar):
print("hello world")
编辑:运行 VSCode
中的 pylint[预期行为] pylint 将 'bar' 突出显示为未使用的变量
[实际行为] 从VScode输出
##########Linting Output - pylint##########
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
我没有额外的 pylint 配置设置
事实证明 VSCode 中有一个设置强制执行最少的检查程序
Python › Linting: Pylint Use Minimal Checkers
我在 pylint documentation 中找到了这个:
possibly-unused-variable (W0641):
Possibly unused variable %r Used when a variable is defined but might not be used. The possibility comes from the fact that locals() might be used, which could consume or not the said variable
在你的情况下,可能是因为你没有在你的函数中使用 bar
参数。如果您不使用它,只需将其删除以获取清洁代码。
如果您想更改此设置,请查看关于 linting 的官方 VS Code documentation。