Showing 4,191 of 4,191 total issues
Merge this if statement with the enclosing one. Open
if (
- Read upRead up
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if condition1: if condition2: # ...
Compliant Solution
if condition1 and condition2: # ...
Merge this if statement with the enclosing one. Open
if src_fn == '' or tar_fn == '':
- Read upRead up
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if condition1: if condition2: # ...
Compliant Solution
if condition1 and condition2: # ...
TODO found Open
# TODO(alan): Platform dependent types
- Exclude checks
TODO found Open
# TODO(shoyer): remove when the full numpy namespace is defined
- Exclude checks
Wrong hanging indentation before block (add 4 spaces). Open
fp: float = 0.0,
- Read upRead up
- Exclude checks
TODO fp: float = 0.0, ^ |
Wrong hanging indentation before block (add 4 spaces). Open
and self._tn == other.true_neg()
- Read upRead up
- Exclude checks
TODO and self.tn == other.trueneg() ^ |
Wrong hanging indentation before block (add 4 spaces). Open
and self._fn == other.false_neg()
- Read upRead up
- Exclude checks
TODO and self.fn == other.falseneg() ^ |
Wrong hanging indentation before block (add 4 spaces). Open
'l',
- Read upRead up
- Exclude checks
TODO 'l', ^ |
Wrong hanging indentation before block (add 4 spaces). Open
's',
- Read upRead up
- Exclude checks
TODO 's', ^ |
Too few public methods (1/2) Open
class _Stemmer:
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Too many lines in module (1248/1000) Open
# Copyright 2014-2020 by Christopher C. Little.
- Read upRead up
- Exclude checks
Used when a module has too many lines, reducing its readability.
Either merge this branch with the identical one on line "701" or change one of the implementations. Open
return _fmt_retval(self._match_type_dict['transposition'])
- Read upRead up
- Exclude checks
Having two branches in the same if
structure with the same implementation is at best duplicate code, and at worst a coding error. If
the same logic is truly needed for both instances, then they should be combined.
Noncompliant Code Example
if 0 <= a < 10: do_the_thing() elif 10 <= a < 20: do_the_other_thing() elif 20 <= a < 50: do_the_thing() # Noncompliant; duplicates first condition else: do_the_rest() b = 4 if a > 12 else 4
Compliant Solution
if (0 <= a < 10) or (20 <= a < 50): do_the_thing() elif 10 <= a < 20: do_the_other_thing() else: do_the_rest() b = 4
or
if 0 <= a < 10: do_the_thing() elif 10 <= a < 20: do_the_other_thing() elif 20 <= a < 50: do_the_third_thing() else: do_the_rest() b = 8 if a > 12 else 4
Merge this if statement with the enclosing one. Open
if (
- Read upRead up
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if condition1: if condition2: # ...
Compliant Solution
if condition1 and condition2: # ...
Refactor this function to reduce its Cognitive Complexity from 31 to the 15 allowed. Open
def dist_abs(self, src: str, tar: str) -> float:
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed. Open
def cmp_features(
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Wrong hanging indentation before block (add 4 spaces). Open
symmetric: bool = False,
- Read upRead up
- Exclude checks
TODO symmetric: bool = False, ^ |
Wrong hanging indentation before block (add 4 spaces). Open
src_collection: Union[Sequence[str], Set[str]],
- Read upRead up
- Exclude checks
TODO src_collection: Union[Sequence[str], Set[str]], ^ |
Unnecessary elif
after raise
Open
if not hasattr(collection, '__iter__'):
- Read upRead up
- Exclude checks
Used in order to highlight an unnecessary block of code following an if containing a raise statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a raise statement.
Consider using enumerate instead of iterating with range and len Open
for i in range(len(word)):
- Read upRead up
- Exclude checks
Emitted when code that iterates with range and len is encountered. Such code can be simplified by using the enumerate builtin.
Wrong hanging indentation before block (add 4 spaces). Open
and len(word) - suffix_len >= 2
- Read upRead up
- Exclude checks
TODO and len(word) - suffix_len >= 2 ^ |