Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is --line-length argument working? #357

Closed
BartolomeSintes opened this issue Dec 12, 2023 · 6 comments
Closed

is --line-length argument working? #357

BartolomeSintes opened this issue Dec 12, 2023 · 6 comments

Comments

@BartolomeSintes
Copy link

I am using VSCode 1.85 with Ruff extension updated (0.1.5).
I am trying to set the limit-length argument, but the E501 is not showing.
I think some screenshots will be useful in order to explain the issue:
My program is just two lines: one with an f-string without placeholders (line 2) and another one with a long line (line 3, 135 characters long). The F541 warning is shown as expected:
2023-12-12-1
If I ignore the F541 warning in settings.json, the warning is not shown anymore:
2023-12-12-2
So ruff seems to be working as expected, but the E501 is not shown.
I understand that line length must be set in ruff.lint.args, as explained in astral-sh/ruff#8363
Am I doing something wrong or is it a ruff extension bug?
Thanking you in advance,
Bartolomé Sintes

@charliermarsh
Copy link
Member

Sorry for the confusion -- we no longer include E501 in the default rule set, so you need to add --select=E501 or --select=E to your ruff.lint.args.

@charliermarsh
Copy link
Member

You can see the default configuration at the top here: https://docs.astral.sh/ruff/configuration/

@BartolomeSintes
Copy link
Author

Thank you for your fast answer. You are completely right.
When I read the pull 8363, "Add --line-length option to format command" I did not realize it was a pull in the ruff repository, not in the ruff-vscode one. I supposed that line-length should be added to the ruff.format.args section, not to the ruff.lint.args as it should. My mistake, sorry.
Keep your very good work!

@jmakov
Copy link

jmakov commented Jan 3, 2024

What's even more confusing to me is running ruff check --line-length 10 my.py doesn't return any errors.

@charliermarsh
Copy link
Member

@jmakov -- Per the above, you need to enable the line-length rule -- it's not included by default, since it often conflicts with using a formatter. Can you try adding --extend-select=E to your command and configuration?

@jmakov
Copy link

jmakov commented Jan 3, 2024

@jmakov -- Per the above, you need to enable the line-length rule -- it's not included by default, since it often conflicts with using a formatter. Can you try adding --extend-select=E to your command and configuration?

Thank you for the quick response. Yes, that works. Would expect a flag to overwrite everything when the user uses it. Anyhow, my probl is solved, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants