Trying to change the Ruff default line length
Asked Answered
R

0

9

I was recently introduced to Ruff a python linter. I have an existing directory with lots of files. I thought to try it out and made a pyproject.toml file in the directory. I want to set the line-length high (150) to show less errors but the default (88) keeps appearing. I also tried the ignore option but that does not seem to work either. Do I need to type a command to initiate the use of the pyproject.toml?

code from 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

Another option is to have the linter ignore line lengths.

Ridicule answered 26/7, 2023 at 20:30 Comment(2)
We have the same sort of file which works fine. Only thing I can think of is that the pyproject.toml is not in the correct place. But that's hard to determine from your question. If you run ruff check -v . it will output something like [2023-09-26][14:21:16][ruff_cli::resolve][DEBUG] Using pyproject.toml (parent) at /home/uittenbroek/projects/myproject/pyproject.tomlStrategy
Have you tried putting the line-length = 150 at the top rather than at the bottom? [tool.ruff] line-length = 150 indent-width = 4 [tool.ruff.lint] select = ["C","E","F","W"] ignore = ["E501"]Chromaticity

© 2022 - 2024 — McMap. All rights reserved.