class ComparisonChecker(_BasicChecker): (source)
Checks for comparisons. - singleton comparison: 'expr == True', 'expr == False' and 'expr == None' - yoda condition: 'const "comp" right' where comp can be '==', '!=', '<', '<=', '>' or '>=', and right can be a variable, an attribute, a method or a function
Method | visit |
Undocumented |
Class Variable | msgs |
Undocumented |
Method | _check |
Undocumented |
Method | _check |
When two constants are being compared it is always a logical tautology. |
Method | _check |
Check if we compare to a literal, which is usually what we do not want to do. |
Method | _check |
Check if identifier is compared against itself. |
Method | _check |
Undocumented |
Method | _check |
Check if == or != is being used to compare a singleton value. |
Method | _check |
Check for expressions like type(x) == Y. |
Method | _check |
Undocumented |
Inherited from _BasicChecker
:
Class Variable | name |
Name of the provider. |
Inherited from BaseChecker
(via _BasicChecker
):
Method | __eq__ |
Permit to assert Checkers are equal. |
Method | __gt__ |
Sorting of checkers. |
Method | __hash__ |
Make Checker hashable. |
Method | __init__ |
Checker instances should have the linter as argument. |
Method | __repr__ |
Undocumented |
Method | __str__ |
This might be incomplete because multiple classes inheriting BaseChecker can have the same name. |
Method | add |
Undocumented |
Method | check |
Check the consistency of msgid. |
Method | close |
Called after visiting project (i.e set of modules). |
Method | create |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | open |
Called before visiting project (i.e. set of modules). |
Method | reduce |
Undocumented |
Class Variable | enabled |
Undocumented |
Class Variable | options |
Options provided by this provider. |
Class Variable | reports |
Undocumented |
Instance Variable | linter |
Undocumented |
Property | messages |
Undocumented |
Inherited from _ArgumentsProvider
(via _BasicChecker
, BaseChecker
):
Method | get |
DEPRECATED: Return the dictionary defining an option given its name. |
Method | level |
Undocumented |
Method | load |
DEPRECATED: Initialize the provider using default values. |
Method | option |
DEPRECATED: Get the config attribute corresponding to opt. |
Method | option |
DEPRECATED: Get the current value for the given option. |
Method | options |
DEPRECATED. |
Method | options |
DEPRECATED: Return an iterator on options grouped by section. |
Method | set |
DEPRECATED: Method called to set an option (registered in the options list). |
Class Variable | option |
Option groups of this provider and their descriptions. |
Property | config |
Undocumented |
Property | level |
Undocumented |
Instance Variable | _arguments |
The manager that will parse and register any options provided. |
Instance Variable | _level |
Undocumented |
def visit_compare(self, node:
nodes.Compare
):
(source)
¶
Undocumented
Check if identifier is compared against itself. :param node: Compare node :Example: val = 786 if val == val: # [comparison-with-itself] pass
nodes.NodeNG
, right_value: nodes.NodeNG
, root_node: nodes.Compare
, checking_for_absence: bool
= False):
(source)
¶
Undocumented
nodes.NodeNG
, right_value: nodes.NodeNG
, root_node: nodes.Compare
, checking_for_absence: bool
= False):
(source)
¶
Check if == or != is being used to compare a singleton value.
nodes.Compare
, left: nodes.NodeNG
, operator: str
, right: nodes.NodeNG
):
(source)
¶
Check for expressions like type(x) == Y.