chrislit/abydos

View on GitHub

Showing 383 of 4,191 total issues

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

    def stem(self, word: str) -> str:
        """Return Caumanns German stem.

        Parameters
        ----------
Severity: Minor
Found in abydos/stemmer/_caumanns.py - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
Open

    def sim(self, src: str, tar: str) -> float:
        """Return the Positional Q-Gram Dice coefficient of two strings.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_positional_q_gram_dice.py - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
Open

    def sim(self, src: str, tar: str) -> float:
        """Return the Positional Q-Gram Jaccard coefficient of two strings.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_positional_q_gram_jaccard.py - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
Open

    def sim(self, src: str, tar: str) -> float:
        """Return the Victorian Panel Study score of two words.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_vps.py - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
Open

    def dist_abs(self, src: str, tar: str) -> float:
        """Return the Meta-Levenshtein distance of two strings.

        Parameters
        ----------
Severity: Minor
Found in abydos/distance/_meta_levenshtein.py - About 2 hrs 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

File _corpus.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2014-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Severity: Minor
Found in abydos/corpus/_corpus.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                        if current > 0 and _string_at(current, 4, {'CHAE'}):
                            primary, secondary = _metaph_add('K', 'X')
                            current += 2
                            continue
    
    
    Severity: Critical
    Found in abydos/phonetic/_double_metaphone.py - About 2 hrs to fix

      Function lmean has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def lmean(nums: Sequence[float]) -> float:
          r"""Return logarithmic mean.
      
          The logarithmic mean of an arbitrarily long series is defined by
          http://www.survo.fi/papers/logmean.pdf
      Severity: Minor
      Found in abydos/stats/_mean.py - About 2 hrs 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 list_installed_packages has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def list_installed_packages(
          path: Optional[str] = None,
      ) -> List[Tuple[str, str, float]]:
          """List all installed data packages."""
          if path:
      Severity: Minor
      Found in abydos/util/_data.py - About 2 hrs 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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def encode(self, word: str, **kwargs: Any) -> str:
              """Return the Soundex code for a word.
      
              Parameters
              ----------
      Severity: Minor
      Found in abydos/phonetic/_soundex.py - About 2 hrs 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 _isg_i has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _isg_i(self, src: str, tar: str) -> float:
              """Return an individual ISG similarity (not symmetric) for src to tar.
      
              Parameters
              ----------
      Severity: Minor
      Found in abydos/distance/_isg.py - About 2 hrs 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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def sim_matrix(
              src: str,
              tar: str,
              mat: Optional[Dict[Tuple[str, str], int]] = None,
              mismatch_cost: float = 0,
      Severity: Minor
      Found in abydos/distance/_needleman_wunsch.py - About 2 hrs 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

      File _generalized_fleiss.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2019-2020 by Christopher C. Little.
      # This file is part of Abydos.
      #
      # Abydos is free software: you can redistribute it and/or modify
      # it under the terms of the GNU General Public License as published by
      Severity: Minor
      Found in abydos/distance/_generalized_fleiss.py - About 2 hrs to fix

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

            def stem(self, word: str) -> str:
                """Return Snowball Swedish stem.
        
                Parameters
                ----------
        Severity: Minor
        Found in abydos/stemmer/_snowball_swedish.py - About 2 hrs 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

        Consider simplifying this complex logical expression.
        Open

                        if (
                            current > 1
                            and not _is_vowel(current - 2)
                            and _string_at((current - 1), 3, {'ACH'})
                            and (
        Severity: Critical
        Found in abydos/phonetic/_double_metaphone.py - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                          if ename[i + 1 : i + 2] == 'H' and not (
                              i + 1 == elen or ename[i + 2 : i + 3] not in self._uc_v_set
                          ):
                              continue
                          elif i > 0 and (
          Severity: Critical
          Found in abydos/phonetic/_metaphone.py - About 2 hrs to fix

            Function encode has a Cognitive Complexity of 15 (exceeds 5 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

            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 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def dist_abs(self, src: str, tar: str) -> float:
                    """Return the Tichy distance between two strings.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in abydos/distance/_tichy.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 wlcs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def wlcs(self, src: str, tar: str) -> float:
                    """Return the Rouge-W weighted longest common sub-sequence length.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in abydos/distance/_rouge_w.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 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def tokenize(self, string: str) -> 'QSkipgrams':
                    """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/_q_skipgrams.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