LucaCappelletti94/dict_hash

View on GitHub

Showing 17 of 17 total issues

Function _convert has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

def _convert(data: object, use_approximation: bool = False) -> object:
    """Returns given data as an hashable object or dictionary.

    Parameters
    ------------------
Severity: Minor
Found in dict_hash/dict_hash.py - About 1 day 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 too many return statements within this function.
Open

                return dict(
Severity: Major
Found in dict_hash/dict_hash.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return dict(
    Severity: Major
    Found in dict_hash/dict_hash.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return tuple(_convert(e, use_approximation=use_approximation) for e in data)
      Severity: Major
      Found in dict_hash/dict_hash.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return int(data)
        Severity: Major
        Found in dict_hash/dict_hash.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return _convert({
          Severity: Major
          Found in dict_hash/dict_hash.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return [_convert(e, use_approximation=use_approximation) for e in data]
            Severity: Major
            Found in dict_hash/dict_hash.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return _sanitize(
              Severity: Major
              Found in dict_hash/dict_hash.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return _convert(
                Severity: Major
                Found in dict_hash/dict_hash.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return "".join(inspect.getsourcelines(data)[0])
                  Severity: Major
                  Found in dict_hash/dict_hash.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return [_convert(e, use_approximation=use_approximation) for e in data]
                    Severity: Major
                    Found in dict_hash/dict_hash.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return data.pattern
                      Severity: Major
                      Found in dict_hash/dict_hash.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return str(data)
                        Severity: Major
                        Found in dict_hash/dict_hash.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return float(data)
                          Severity: Major
                          Found in dict_hash/dict_hash.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return data
                            Severity: Major
                            Found in dict_hash/dict_hash.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return data.hash()
                              Severity: Major
                              Found in dict_hash/dict_hash.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return sorted([_convert(e, use_approximation=use_approximation) for e in data])
                                Severity: Major
                                Found in dict_hash/dict_hash.py - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language