Skip to content

RUF100 for noqa: E501 not at end of line #7851

@LefterisJP

Description

@LefterisJP

With the new ruff release ruff==0.0.292 all unneeded noqa: E501 comments are detected! Yay!

But this seems to also be valid (or at least have been working until now), having the noqa: E501 in the middle of the comment and then have more comment text after it.

# line length 99
averylongvariablenamethatyouprobablyshouldneveruse = 'avalue'  # noqa: E501  # ruff will try to autofix/remove cause by the end of the pragma the line is <99 but with this extra comment we made it go over, so once autofixed there is a line length violation

If you run ruff --fix on this it will autofix the noqa: E501 away thinking it's not needed since by the end of noqa: E501 line length is less than the limit. Ignoring the fact that the comment continues.

So we will end up with this:

# line length 99
averylongvariablenamethatyouprobablyshouldneveruse = 'avalue'  # ruff will try to autofix/remove cause by the end of the pragma the line is <99 but with this extra comment we made it go over, so once autofixed there is a line length violation

Which will then hit again with a line length violation and need manual fix/action.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsuppressionRelated to supression of violations e.g. noqa

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions