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
FYI SIM103 autofix refactored my code to be incorrect:
(apps-z6RSF3Uo-py3.10) jack@macbook api % cat /tmp/a.py
def verify_user(kind):
if kind != "USER":
return False
else:
return True
(apps-z6RSF3Uo-py3.10) jack@macbook api % ruff /tmp/a.py
/tmp/a.py:2:5: SIM103 Return the condition `kind != "USER"` directly
Found 1 error(s).
1 potentially fixable with the --fix option.
(apps-z6RSF3Uo-py3.10) jack@macbook api % ruff /tmp/a.py --fix
Found 1 error(s) (1 fixed, 0 remaining).
(apps-z6RSF3Uo-py3.10) jack@macbook api % cat /tmp/a.py
def verify_user(kind):
return kind != "USER"
(apps-z6RSF3Uo-py3.10) jack@macbook api %
In the first case, the function returns False if the kind is not "USER", and True otherwise. In the fixed function, it returns the opposite. In the REPL:
FYI
SIM103
autofix refactored my code to be incorrect:In the first case, the function returns
False
if the kind is not"USER"
, and True otherwise. In the fixed function, it returns the opposite. In the REPL:Originally posted by @jackklika in #998 (comment)
The text was updated successfully, but these errors were encountered: