chrislit/abydos

View on GitHub

Showing 383 of 4,191 total issues

Avoid too many return statements within this function.
Open

                return _fmt_retval(self._match_type_dict['inclusion'])
Severity: Major
Found in abydos/distance/_synoname.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return 0
    Severity: Major
    Found in abydos/distance/_synoname.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                              return _fmt_retval(self._match_type_dict['initials'])
      Severity: Major
      Found in abydos/distance/_synoname.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return _fmt_retval(self._match_type_dict['word_approx'])
        Severity: Major
        Found in abydos/distance/_synoname.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 1
          Severity: Major
          Found in abydos/distance/_rees_levenshtein.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return cast(
            Severity: Major
            Found in abydos/distance/_tversky.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return cast(float, d_mat[src_len, tar_len])
              Severity: Major
              Found in abydos/distance/_levenshtein.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return cast(float, d_mat[src_len, tar_len])
                Severity: Major
                Found in abydos/distance/_phonetic_edit_distance.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return 0
                  Severity: Major
                  Found in abydos/distance/_mra.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return cast(float, d_mat[src_len, tar_len])
                    Severity: Major
                    Found in abydos/distance/_editex.py - About 30 mins to fix

                      Function _normalize_lang_attrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _normalize_lang_attrs(self, text: str, strip: bool) -> str:
                              """Remove embedded bracketed attributes.
                      
                              This (potentially) bitwise-ands bracketed attributes together and adds
                              to the end.
                      Severity: Minor
                      Found in abydos/phonetic/_beider_morse.py - About 25 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 package_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def package_path(resource_name: str) -> str:
                          """Given a resource name, returns the path to the package."""
                          for path in data_path:
                              for subdir in DATA_SUBDIRS:
                                  check_path = os.path.join(path, subdir, resource_name)
                      Severity: Minor
                      Found in abydos/util/_data.py - About 25 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 _ncr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def _ncr(n: float, r: float) -> float:
                          r"""Return n Choose r.
                      
                          Cf. https://en.wikipedia.org/wiki/Combination
                      
                      
                      Severity: Minor
                      Found in abydos/util/_ncr.py - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(
                              self,
                              variant: int = 1,
                              doubles: bool = True,
                              vowels: Optional[Union[Iterable[str], str]] = None,
                      Severity: Minor
                      Found in abydos/fingerprint/_consonant.py - About 25 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 fingerprint_int has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def fingerprint_int(self, word: str) -> int:
                              """Return the count fingerprint.
                      
                              Parameters
                              ----------
                      Severity: Minor
                      Found in abydos/fingerprint/_count.py - About 25 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 _tokenize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _tokenize(
                              self, src: Union[str, TCounter[str]], tar: Union[str, TCounter[str]]
                          ) -> '_TokenDistance':
                              """Return the Q-Grams in src & tar.
                      
                      
                      Severity: Minor
                      Found in abydos/distance/_token_distance.py - About 25 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 dist_abs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def dist_abs(self, src: str, tar: str) -> float:
                              """Return the Shapira & Storer I edit distance between two strings.
                      
                              Parameters
                              ----------
                      Severity: Minor
                      Found in abydos/distance/_shapira_storer_i.py - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sim(self, src: str, tar: str) -> float:
                              """Return the BLEU similarity of two strings.
                      
                              Parameters
                              ----------
                      Severity: Minor
                      Found in abydos/distance/_bleu.py - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sim(self, src: str, tar: str) -> float:
                              """Return the Tversky index of two strings.
                      
                              Parameters
                              ----------
                      Severity: Minor
                      Found in abydos/distance/_tversky.py - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(
                              self,
                              nltk_tokenizer: Optional[object] = None,
                              scaler: Optional[Union[str, Callable[[float], float]]] = None,
                          ) -> None:
                      Severity: Minor
                      Found in abydos/tokenizer/_nltk.py - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language