chrislit/abydos

View on GitHub

Showing 4,191 of 4,191 total issues

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

            'eret',
Severity: Info
Found in abydos/stemmer/_snowball_danish.py by pylint

TODO 'eret', ^ |

Too many branches (110/12)
Open

    def stem(self, word: str) -> str:
Severity: Info
Found in abydos/stemmer/_porter.py by pylint

Used when a function or method has too many branches, making it hard to follow.

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

            'tt',
Severity: Info
Found in abydos/stemmer/_lovins.py by pylint

TODO 'tt', ^ |

Refactor this function to reduce its Cognitive Complexity from 121 to the 15 allowed.
Open

    def _group_linkage_intersection(self) -> TCounter[str]:
Severity: Critical
Found in abydos/distance/_token_distance.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

Correct one of the identical sub-expressions on both sides of operator "or".
Open

                        or (
                            initial_diff
                            == self._lev.dist_abs(
                                src_initials_str, tar_initials_str,
                            )
Severity: Major
Found in abydos/distance/_synoname.py by sonar-python

Using the same value on either side of a binary operator is almost always a mistake. In the case of logical operators, it is either a copy/paste error and therefore a bug, or it is simply wasted code, and should be simplified. In the case of bitwise operators and most binary mathematical operators, having the same value on both sides of an operator yields predictable results, and should be simplified.

This rule ignores *, +, and =.

Noncompliant Code Example

if a == a: # Noncompliant
    work()

if  a != a: # Noncompliant
    work()

if  a == b and a == b: # Noncompliant
    work()

if a == b or a == b: # Noncompliant
    work()

j = 5 / 5 # Noncompliant
k = 5 - 5 # Noncompliant

Exceptions

The following are ignored:

  • The expression 1 << 1

See

  • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
  • CERT, MSC12-CPP. - Detect and remove code that has no effect
  • {rule:python:S1656} - Implements a check on =.

Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
Open

    def sim(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 53 to the 15 allowed.
Open

    def dist_abs(self, src: str, tar: str) -> float:
Severity: Critical
Found in abydos/distance/_sift4_extended.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

Merge this if statement with the enclosing one.
Open

                            if (ying[i], yang[j]) in adjwt:
Severity: Major
Found in abydos/distance/_strcmp95.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:
    # ...

Consider using enumerate instead of iterating with range and len
Open

        for i in range(len(nums)):
Severity: Info
Found in abydos/stats/_mean.py by pylint

Emitted when code that iterates with range and len is encountered. Such code can be simplified by using the enumerate builtin.

Too many lines in module (2176/1000)
Open

# Copyright 2014-2020 by Christopher C. Little.
Severity: Info
Found in abydos/stats/_confusion_table.py by pylint

Used when a module has too many lines, reducing its readability.

Too many public methods (65/20)
Open

class ConfusionTable:
Severity: Info
Found in abydos/stats/_confusion_table.py by pylint

Used when class has too many public methods, try to reduce this to get a simpler (and so easier to use) class.

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

            'ethed',
Severity: Info
Found in abydos/stemmer/_snowball_danish.py by pylint

TODO 'ethed', ^ |

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

            'eres',
Severity: Info
Found in abydos/stemmer/_snowball_danish.py by pylint

TODO 'eres', ^ |

Too many branches (18/12)
Open

    def stem(self, word: str) -> str:
Severity: Info
Found in abydos/stemmer/_snowball_danish.py by pylint

Used when a function or method has too many branches, making it hard to follow.

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

            'mm',
Severity: Info
Found in abydos/stemmer/_lovins.py by pylint

TODO 'mm', ^ |

Merge this if statement with the enclosing one.
Open

            if (src_fn and src_fn in tar_fn) or (tar_fn and tar_fn in src_ln):
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 20 to the 15 allowed.
Open

    def tokenize(self, string: str) -> 'CVClusterTokenizer':
Severity: Critical
Found in abydos/tokenizer/_cv_cluster.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

Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
Open

    def tokenize(self, string: str) -> 'VCClusterTokenizer':
Severity: Critical
Found in abydos/tokenizer/_vc_cluster.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

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

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

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

    metric: Optional[Callable[[str, str], float]] = None,
Severity: Info
Found in abydos/stats/_pairwise.py by pylint

TODO metric: Optional[Callable[[str, str], float]] = None, ^ |

Severity
Category
Status
Source
Language