You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it applies to all error codes, but let me give an example where I encountered that.
Consider:
data=do_some_transformations()
returndata
Which is a violation of RET504 - unnecessary assignment.
I needed to perform the assignment and return data, not return do_some_transformations(), so added a noqa: RET504 with explanation of why I want to bypass the rule:
data=do_some_transformations()
returndata# noqa: RET504 - to be able to debug the returned object.
Then I disabled RET504 in ruff config completely, and this noqa became unused. Here is where RUF100 comes into play, as it complains on unused error codes, and provides a fix.
The fix was:
- return data # noqa: RET504 - to be able to debug the returned object+ return data # - to be able to debug the returned object
While I believe it should have been:
- return data # noqa: RET504 - to be able to debug the returned object+ return data
As it's probably quite safe to assume that entire content of the comment noqa is part of is explaining why a rule should by bypassed.
List of keywords you searched for before creating this issue: RUF100
I think it applies to all error codes, but let me give an example where I encountered that.
Consider:
Which is a violation of
RET504- unnecessary assignment.I needed to perform the assignment and
return data, notreturn do_some_transformations(), so added anoqa: RET504with explanation of why I want to bypass the rule:Then I disabled
RET504inruffconfig completely, and thisnoqabecame unused. Here is whereRUF100comes into play, as it complains on unused error codes, and provides a fix.The fix was:
While I believe it should have been:
As it's probably quite safe to assume that entire content of the comment
noqais part of is explaining why a rule should by bypassed.RUF100ruff check --fix0.5.1.