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: # ...
Refactor this function to reduce its Cognitive Complexity from 30 to the 15 allowed. Open
def _alignment_matrix(
- 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
TODO found Open
_DtypeLikeNested = Any # TODO: wait for support for recursive types
- Exclude checks
Wrong hanging indentation before block (add 4 spaces). Open
ddof: int = 0,
- Read upRead up
- Exclude checks
TODO ddof: int = 0, ^ |
Wrong hanging indentation before block (add 4 spaces). Open
and self._tn == other['tn']
- Read upRead up
- Exclude checks
TODO and self._tn == other['tn'] ^ |
Wrong hanging indentation before block (add 4 spaces). Open
ending in self._suffix
- Read upRead up
- Exclude checks
TODO ending in self._suffix ^ |
Wrong hanging indentation before block (add 4 spaces). Open
'll',
- Read upRead up
- Exclude checks
TODO 'll', ^ |
Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed. Open
def _cost(self, src: str, s_pos: int, tar: str, t_pos: int) -> 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
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: # ...
Remove those useless parentheses. Open
return ((a + d) - ((a + b) * (a + c) + (c + d) * (b + d))) / (
- Read upRead up
- Exclude checks
The use of parentheses, even those not required to enforce a desired order of operations, can clarify the intent behind a piece of code. But redundant pairs of parentheses could be misleading, and should be removed.
Noncompliant Code Example
return ((3)) # Noncompliant return ((x + 1)) # Noncompliant x = ((y / 2)) + 1 # Noncompliant
Compliant Solution
return 3 return (3) return x + 1 return (x + 1) x = y / 2 + 1 x = (y / 2) + 1
Refactor this function to reduce its Cognitive Complexity from 26 to the 15 allowed. Open
def tokenize(self, string: str) -> 'COrVClusterTokenizer':
- 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
TODO found Open
# TODO: add a protocol for anything with a dtype attribute
- Exclude checks
Unnecessary elif
after return
Open
if nums[0] <= 0 or nums[1] <= 0:
- Read upRead up
- Exclude checks
Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.
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
'heds',
- Read upRead up
- Exclude checks
TODO 'heds', ^ |
Too few public methods (1/2) Open
class Porter(_Stemmer):
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Refactor this function to reduce its Cognitive Complexity from 34 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
Wrong hanging indentation before block (add 4 spaces). Open
m_h, prec
- Read upRead up
- Exclude checks
TODO m_h, prec ^ |
Wrong hanging indentation before block (add 4 spaces). Open
mean_func: Callable[[Sequence[float]], float] = amean,
- Read upRead up
- Exclude checks
TODO mean_func: Callable[[Sequence[float]], float] = amean, ^ |
Wrong hanging indentation before block (add 4 spaces). Open
tp: Union[
- Read upRead up
- Exclude checks
TODO tp: Union[ ^ |