【问题标题】:VS code pylint errors and format not workingVS 代码 pylint 错误和格式不起作用
【发布时间】:2021-01-11 18:02:15
【问题描述】:

这是来自测试 python 文件的错误代码:

asdf = "test"

print(asdf)


my_list = [1,2,3,4,5]

# expected on save
my_list = [1, 2, 3, 4, 5]

for num in my_list:
  print(num)

# Expected on save (does not format)
# print(num)

# if i manully indent to 2 spaces it gives me this error:
#   "Bad indentation. Found 2 spaces, expected 4"

这是我遇到的错误

这是 pip freeze 命令截图:

这是我的 VS 代码用户设置:

我不确定为什么会收到这些错误以及为什么它没有格式化。

【问题讨论】:

标签: python-3.x visual-studio-code pylint python-black


【解决方案1】:

这些是约定错误,而不是功能错误。这意味着您的代码不遵循特定的编码约定。在 Pylint 中是 PEP8。

来自 wiki-dot 的错误解释:

  1. valid-name

  2. missing-final-newline

【讨论】:

    猜你喜欢
    • 2018-10-22
    • 1970-01-01
    • 2022-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多