最近我向 Ruff 介绍了一个 python linter。我有一个包含大量文件的现有目录。我想尝试一下,并在目录中创建了一个 pyproject.toml 文件。我想将行长设置为高(150)以显示更少的错误,但默认值(88)不断出现。我还尝试了忽略选项,但这似乎也不起作用。我需要输入命令来启动 pyproject.toml 的使用吗?
来自 pyproject.toml 的代码
[tool.ruff]
extend-select = ["C4", "NPY", "PD", "SIM", "TCH"]
ignore = ["E501"]
show-fixes = true
# target-version = "py310"
# change the default line length number or characters.
line-length = 150
另一种选择是让 linter 忽略行长度。
将
line-length
更改为 max-line-length
解决了我的问题。
# change the default line length number or characters.
max-line-length = 150