-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[literal-comparison] Make the message explicit with the solution
Also update the confidence Closes #5237
- Loading branch information
1 parent
d200f81
commit 19b4fda
Showing
7 changed files
with
43 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
def is_an_orange(fruit): | ||
return fruit is "orange" # [literal-comparison] | ||
return fruit is "orange" # [literal-comparison] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The message for ``literal-comparison`` is now more explicit about the problem and the | ||
solution. | ||
|
||
Closes #5237 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
comparison-of-constants:4:3:4:9::"Comparison between constants: '2 is 2' has a constant value":HIGH | ||
literal-comparison:4:3:4:9::Comparison to literal:UNDEFINED | ||
literal-comparison:4:3:4:9::In '2 is 2', use '==' when comparing constant literals not 'is' ('2 == 2'):HIGH | ||
comparison-of-constants:7:6:7:12::"Comparison between constants: '2 == 2' has a constant value":HIGH | ||
comparison-of-constants:10:6:10:11::"Comparison between constants: '2 > 2' has a constant value":HIGH | ||
comparison-of-constants:20:3:20:15::"Comparison between constants: 'True == True' has a constant value":HIGH | ||
singleton-comparison:20:3:20:15::Comparison 'True == True' should be 'True is True' if checking for the singleton value True, or 'True' if testing for truthiness:UNDEFINED | ||
literal-comparison:25:3:25:13::Comparison to literal:UNDEFINED | ||
literal-comparison:28:3:28:13::Comparison to literal:UNDEFINED | ||
literal-comparison:31:3:31:14::Comparison to literal:UNDEFINED | ||
literal-comparison:25:3:25:13::In 'CONST is 0', use '==' when comparing constant literals not 'is' ('CONST == 0'):HIGH | ||
literal-comparison:28:3:28:13::In 'CONST is 1', use '==' when comparing constant literals not 'is' ('CONST == 1'):HIGH | ||
literal-comparison:31:3:31:14::In 'CONST is 42', use '==' when comparing constant literals not 'is' ('CONST == 42'):HIGH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
comparison-of-constants:4:3:4:9::"Comparison between constants: '2 is 2' has a constant value":HIGH | ||
literal-comparison:4:3:4:9::Comparison to literal:UNDEFINED | ||
literal-comparison:4:3:4:9::In '2 is 2', use '==' when comparing constant literals not 'is' ('2 == 2'):HIGH | ||
comparison-of-constants:7:3:7:14::"Comparison between constants: 'a is b'a'' has a constant value":HIGH | ||
literal-comparison:7:3:7:14::Comparison to literal:UNDEFINED | ||
literal-comparison:7:3:7:14::In ''a' is b'a'', use '==' when comparing constant literals not 'is' (''a' == b'a''):HIGH | ||
comparison-of-constants:10:3:10:13::"Comparison between constants: '2.0 is 3.0' has a constant value":HIGH | ||
literal-comparison:10:3:10:13::Comparison to literal:UNDEFINED | ||
literal-comparison:16:3:16:19::Comparison to literal:UNDEFINED | ||
literal-comparison:19:3:19:18::Comparison to literal:UNDEFINED | ||
literal-comparison:22:3:22:18::Comparison to literal:UNDEFINED | ||
literal-comparison:25:3:25:23::Comparison to literal:UNDEFINED | ||
literal-comparison:28:3:28:22::Comparison to literal:UNDEFINED | ||
literal-comparison:31:3:31:22::Comparison to literal:UNDEFINED | ||
literal-comparison:38:3:38:13::Comparison to literal:UNDEFINED | ||
literal-comparison:41:3:41:13::Comparison to literal:UNDEFINED | ||
literal-comparison:44:3:44:14::Comparison to literal:UNDEFINED | ||
literal-comparison:10:3:10:13::In '2.0 is 3.0', use '==' when comparing constant literals not 'is' ('2.0 == 3.0'):HIGH | ||
literal-comparison:16:3:16:19::"In '() is {1: 2, 2: 3}', use '==' when comparing constant literals not 'is' ('() == {1: 2, 2: 3}')":HIGH | ||
literal-comparison:19:3:19:18::In '[] is [4, 5, 6]', use '==' when comparing constant literals not 'is' ('[] == [4, 5, 6]'):HIGH | ||
literal-comparison:22:3:22:18::In '() is {1, 2, 3}', use '==' when comparing constant literals not 'is' ('() == {1, 2, 3}'):HIGH | ||
literal-comparison:25:3:25:23::"In '() is not {1: 2, 2: 3}', use '!=' when comparing constant literals not 'is not' ('() != {1: 2, 2: 3}')":HIGH | ||
literal-comparison:28:3:28:22::In '[] is not [4, 5, 6]', use '!=' when comparing constant literals not 'is not' ('[] != [4, 5, 6]'):HIGH | ||
literal-comparison:31:3:31:22::In '() is not {1, 2, 3}', use '!=' when comparing constant literals not 'is not' ('() != {1, 2, 3}'):HIGH | ||
literal-comparison:38:3:38:13::In 'CONST is 0', use '==' when comparing constant literals not 'is' ('CONST == 0'):HIGH | ||
literal-comparison:41:3:41:13::In 'CONST is 1', use '==' when comparing constant literals not 'is' ('CONST == 1'):HIGH | ||
literal-comparison:44:3:44:14::In 'CONST is 42', use '==' when comparing constant literals not 'is' ('CONST == 42'):HIGH |