chrislit/abydos

View on GitHub

Showing 4,191 of 4,191 total issues

Merge this if statement with the enclosing one.
Open

                    if (

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 == '':
Severity: Major
Found in abydos/distance/_synoname.py by sonar-python

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
Severity: Minor
Found in stubs/numpy/__init__.pyi by fixme

TODO found
Open

# TODO(shoyer): remove when the full numpy namespace is defined
Severity: Minor
Found in stubs/numpy/__init__.pyi by fixme

Wrong hanging indentation before block (add 4 spaces).
Open

        fp: float = 0.0,
Severity: Info
Found in abydos/stats/_confusion_table.py by pylint

TODO fp: float = 0.0, ^ |

Wrong hanging indentation before block (add 4 spaces).
Open

                and self._tn == other.true_neg()
Severity: Info
Found in abydos/stats/_confusion_table.py by pylint

TODO and self.tn == other.trueneg() ^ |

Wrong hanging indentation before block (add 4 spaces).
Open

                and self._fn == other.false_neg()
Severity: Info
Found in abydos/stats/_confusion_table.py by pylint

TODO and self.fn == other.falseneg() ^ |

Wrong hanging indentation before block (add 4 spaces).
Open

                'l',
Severity: Info
Found in abydos/stemmer/_porter.py by pylint

TODO 'l', ^ |

Wrong hanging indentation before block (add 4 spaces).
Open

                's',
Severity: Info
Found in abydos/stemmer/_porter.py by pylint

TODO 's', ^ |

Too few public methods (1/2)
Open

class _Stemmer:
Severity: Info
Found in abydos/stemmer/_stemmer.py by pylint

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.
Severity: Info
Found in abydos/stemmer/_lovins.py by pylint

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'])
Severity: Major
Found in abydos/distance/_synoname.py by sonar-python

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 (
Severity: Major
Found in abydos/distance/_synoname.py by sonar-python

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:

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(
Severity: Critical
Found in abydos/phones/_phones.py by sonar-python

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,
Severity: Info
Found in abydos/stats/_pairwise.py by pylint

TODO symmetric: bool = False, ^ |

Wrong hanging indentation before block (add 4 spaces).
Open

    src_collection: Union[Sequence[str], Set[str]],
Severity: Info
Found in abydos/stats/_pairwise.py by pylint

TODO src_collection: Union[Sequence[str], Set[str]], ^ |

Unnecessary elif after raise
Open

    if not hasattr(collection, '__iter__'):
Severity: Info
Found in abydos/stats/_pairwise.py by pylint

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)):
Severity: Info
Found in abydos/stemmer/_porter.py by pylint

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
Severity: Info
Found in abydos/stemmer/_lovins.py by pylint

TODO and len(word) - suffix_len >= 2 ^ |

Severity
Category
Status
Source
Language