5

I have a python project and I am configuring latest version of ruff for that project for linting and formating purpose. I have the below settings in my pyproject.toml file:

[tool.ruff]
select = ["E", "F", "W", "Q", "I"]

ignore = ["E203"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# restrict Line length to 99
line-length = 99

The ruff check command with autofix feature (--fix) of ruff identifies that the lines are long with E501 errors, but it does not format that code to wrap to next line to maintain the line-length restriction. Is there something I need to enable or do to ensure that ruff fixes this? Or is this not possible in ruff currently? Please help.

I tried going through the documentation to find anything, but I am clueless what to do here.

shaik moeed
  • 5,300
  • 1
  • 18
  • 54
Sukanya Pai
  • 666
  • 9
  • 24
  • I believe **black** will change the line length for you with you having to do it. Black is a different linter. – Shane S Jul 26 '23 at 20:16
  • Oh yes, black was easy to configure and it did reformat files with length issues. I was also trying out ruff as it is supposed to be a faster alternative to black and wanted to autofix the line length issue through ruff alone without combining with other linters. – Sukanya Pai Jul 27 '23 at 12:44
  • Long lines are strings or comments or code lines? – shaik moeed Aug 17 '23 at 09:45

0 Answers0