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
The rule only triggers when the first argument to isinstance is an identifier. This is a false negative because any expression would work in that context.
If the expression consists purely of certain literals and operators, like 1 + 1, applying the FURB168 fix would produce a warning like SyntaxWarning: "is" with 'int' literal. Did you mean "=="?. That might be a reason the rule is currently so restricted, but I think it is better to apply the fix: the code is suspect either way but at least with the fix the user gets an explicit warning.
The first false positive is that the rule does not check whether type is the built-in type. (It does correctly check isinstance.)
Description
isinstance-type-none
(FURB168) has a false negative and two false positives in Ruff 0.9.3.The rule only triggers when the first argument to
isinstance
is an identifier. This is a false negative because any expression would work in that context.If the expression consists purely of certain literals and operators, like
1 + 1
, applying the FURB168 fix would produce a warning likeSyntaxWarning: "is" with 'int' literal. Did you mean "=="?
. That might be a reason the rule is currently so restricted, but I think it is better to apply the fix: the code is suspect either way but at least with the fix the user gets an explicit warning.The first false positive is that the rule does not check whether
type
is the built-intype
. (It does correctly checkisinstance
.)The second false positive is that
None | None
is accepted as meaningtype(None)
. That raises aTypeError
which the fix suppresses.The text was updated successfully, but these errors were encountered: