chrislit/abydos

View on GitHub

Showing 383 of 4,191 total issues

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

    def fingerprint_int(self, word: str) -> int:
        """Return the LACSS coding.

        Parameters
        ----------
Severity: Minor
Found in abydos/fingerprint/_lacss.py - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                        for row in range(n):
                            if (
                                not (row_covered[row])
                                and arr[row, col] < h_val
                            ):
Severity: Major
Found in abydos/distance/_token_distance.py - About 45 mins to fix

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

        def sim(self, src: str, tar: str) -> float:
            """Return the BI-SIM similarity of two strings.
    
            Parameters
            ----------
    Severity: Minor
    Found in abydos/distance/_bisim.py - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                            for key, value in tar_feat[i].items():
                                if key != 'supplemental':
                                    tar_feat[j][key] = value
                            j = 0
    Severity: Major
    Found in abydos/distance/_aline.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              for key, value in src_feat[i].items():
                                  if key != 'supplemental':
                                      src_feat[j][key] = value
                              j = 0
      Severity: Major
      Found in abydos/distance/_aline.py - About 45 mins to fix

        Function corr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def corr(self, src: str, tar: str) -> float:
                """Return the Hurlbert correlation of two strings.
        
                Parameters
                ----------
        Severity: Minor
        Found in abydos/distance/_hurlbert.py - About 45 mins 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_matrix has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def sim_matrix(
        Severity: Minor
        Found in abydos/distance/_needleman_wunsch.py - About 45 mins to fix

          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in abydos/distance/_discounted_levenshtein.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if backtrace:
                                        trace_mat[i + 1, j + 1] = 2
                    if backtrace:
            Severity: Major
            Found in abydos/distance/_discounted_levenshtein.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if i == src_len or j == tar_len:
                                          sg_max = s_mat[i, j]
                                  else:
              Severity: Major
              Found in abydos/distance/_aline.py - About 45 mins to fix

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

                    def sim(self, src: str, tar: str) -> float:
                        """Return the Horn-Morisita similarity of two strings.
                
                        Parameters
                        ----------
                Severity: Minor
                Found in abydos/distance/_horn_morisita.py - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                        if (
                                            abs(sp - tp) <= self._max_dist
                                            and sp not in src_matched
                                            and tp not in tar_matched
                                        ):
                Severity: Major
                Found in abydos/distance/_positional_q_gram_overlap.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (
                                              abs(sp - tp) <= self._max_dist
                                              and sp not in src_matched
                                              and tp not in tar_matched
                                          ):
                  Severity: Major
                  Found in abydos/distance/_positional_q_gram_dice.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if is_trans:
                                                trans += self._transposition_cost_evaluator(
                                                    src_cur, tar_cur
                                                )
                                            elif not ofs['trans']:
                    Severity: Major
                    Found in abydos/distance/_sift4_extended.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if not (col_covered[col] | row_covered[row]):
                                                  break
                                          else:
                      Severity: Major
                      Found in abydos/distance/_token_distance.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if not (col_covered[col] | row_covered[row]):
                                                    primed[row, col] = True
                                                    z_cols = (starred[row, :]).nonzero()[0]
                                                    if not z_cols.size:
                                                        step = 2
                        Severity: Major
                        Found in abydos/distance/_token_distance.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if mode == 1:
                                                      self._ordered_tokens.append(new_token)
                                                      new_token = char
                                                  else:
                                                      new_token += char
                          Severity: Major
                          Found in abydos/tokenizer/_c_or_v_cluster.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if backtrace:
                                                        trace_mat[i + 1, j + 1] = 2
                                    if backtrace:
                            Severity: Major
                            Found in abydos/distance/_phonetic_edit_distance.py - About 45 mins to fix

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

                                  def dist_abs(self, src: str, tar: str, normalized: bool = False) -> float:
                                      """Return the Minkowski distance (:math:`L^p`-norm) of two strings.
                              
                                      Parameters
                                      ----------
                              Severity: Minor
                              Found in abydos/distance/_minkowski.py - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def __init__(
                              Severity: Minor
                              Found in abydos/distance/_tversky.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language