chrislit/abydos

View on GitHub

Showing 383 of 4,191 total issues

Function dist_abs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def dist_abs(self, src: str, tar: str) -> float:
        """Return the MRA comparison rating of two strings.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_mra.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function sim_score has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def sim_score(self, src: str, tar: str) -> float:
        """Return the Guth matching score of two strings.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_guth.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        tp: Union[
            float,
            Tuple[float, float, float, float],
Severity: Minor
Found in abydos/stats/_confusion_table.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __eq__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def __eq__(self, other: object) -> bool:
        """Perform eqality (==) comparison.

        Compares a ConfusionTable to another ConfusionTable or its equivalent
        in the form of a tuple, list, or dict.
Severity: Minor
Found in abydos/stats/_confusion_table.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function dist_abs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def dist_abs(self, src: str, tar: str, normalized: bool = False) -> float:
        """Calculate the distance between the Eudex hashes of two terms.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_eudex.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function sim has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def sim(self, src: str, tar: str) -> float:
        """Return the SoftTF-IDF similarity of two strings.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_softtf_idf.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _s has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _s(self, src: str, tar: str) -> int:
        if src.isupper():
            if tar.isupper():
                return self._s4 if src == tar else self._s5
            else:
Severity: Minor
Found in abydos/distance/_saps.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _synoname_word_approximation has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _synoname_word_approximation(
        self,
        src_ln: str,
        tar_ln: str,
        src_fn: str = '',
Severity: Minor
Found in abydos/distance/_synoname.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

                    if _get_at(current + 1) == 'H':
                        if (current > 0) and not _is_vowel(current - 1):
                            primary, secondary = _metaph_add('K')
                            current += 2
                            continue
    Severity: Critical
    Found in abydos/phonetic/_double_metaphone.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      lokal_ordet[0:1] in self._mjuka_vokaler
                      or lokal_ordet[0:1] in self._harde_vokaler
                  ):
                      lokal_ordet = '$' + lokal_ordet[1:]
      Severity: Critical
      Found in abydos/phonetic/_sfinx_bis.py - About 1 hr to fix

        Function sim_type has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def sim_type(
                self,
                src: Union[str, Tuple[str, str, str]],
                tar: Union[str, Tuple[str, str, str]],
                force_numeric: bool = False,
        Severity: Minor
        Found in abydos/distance/_synoname.py - About 1 hr to fix

          Function stem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def stem(self, word: str) -> str:
                  """Return CLEF German stem.
          
                  Parameters
                  ----------
          Severity: Minor
          Found in abydos/stemmer/_clef_german.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function pairwise_similarity_statistics has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def pairwise_similarity_statistics(
              src_collection: Union[Sequence[str], Set[str]],
              tar_collection: Union[Sequence[str], Set[str]],
              metric: Optional[Callable[[str, str], float]] = None,
              mean_func: Callable[[Sequence[float]], float] = amean,
          Severity: Minor
          Found in abydos/stats/_pairwise.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function stem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def stem(self, word: str) -> str:
                  """Return Lovins stem.
          
                  Parameters
                  ----------
          Severity: Minor
          Found in abydos/stemmer/_lovins.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function fingerprint_int has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def fingerprint_int(self, word: str) -> int:
                  """Return the position fingerprint.
          
                  Parameters
                  ----------
          Severity: Minor
          Found in abydos/fingerprint/_position.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function lcsseq has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def lcsseq(self, src: str, tar: str) -> str:
                  """Return the longest common subsequence of two strings.
          
                  Based on the dynamic programming algorithm from
                  http://rosettacode.org/wiki/Longest_common_subsequence
          Severity: Minor
          Found in abydos/distance/_lcsseq.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function tokenize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def tokenize(self, string: str) -> 'SAPSTokenizer':
                  """Tokenize the term and store it.
          
                  The tokenized term is stored as an ordered list and as a Counter
                  object.
          Severity: Minor
          Found in abydos/tokenizer/_saps.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function encode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def encode(self, word: str) -> str:
                  """Return the Fuzzy Soundex code for a word.
          
                  Parameters
                  ----------
          Severity: Minor
          Found in abydos/phonetic/_fuzzy_soundex.py - About 1 hr to fix

            Function alignments has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def alignments(
                    self, src: str, tar: str, score_only: bool = False
                ) -> Union[float, List[Tuple[float, str, str]]]:
                    """Return the ALINE alignments of two strings.
            
            
            Severity: Minor
            Found in abydos/distance/_aline.py - About 1 hr to fix

              Function mean_pairwise_similarity has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              def mean_pairwise_similarity(
                  collection: Union[str, Sequence[str], Set[str]],
                  metric: Optional[Callable[[str, str], float]] = None,
                  mean_func: Callable[[Sequence[float]], float] = hmean,
                  symmetric: bool = False,
              Severity: Minor
              Found in abydos/stats/_pairwise.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Severity
              Category
              Status
              Source
              Language