ionelmc/python-hunter

View on GitHub

Showing 67 of 67 total issues

Function yield_lines has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def yield_lines(
    filename,
    module_globals,
    start,
    collector,
Severity: Minor
Found in src/hunter/event.py - About 35 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 too many return statements within this function.
Open

        return '{%s}' % ', '.join(safe_repr(i, newdepth) for i in obj)
Severity: Major
Found in src/hunter/util.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return '%s({%s})' % (  # noqa: UP031
    Severity: Major
    Found in src/hunter/util.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return False
      Severity: Major
      Found in src/hunter/predicates.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return f'<{"un" if self is None else ""}bound method {name} of {safe_repr(self, newdepth)}>'
        Severity: Major
        Found in src/hunter/util.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 're.compile(%s, flags=%s)' % (  # noqa: UP031
          Severity: Major
          Found in src/hunter/util.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return True
            Severity: Major
            Found in src/hunter/predicates.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return False
              Severity: Major
              Found in src/hunter/predicates.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return f'{obj_type.__name__}({", ".join(safe_repr(i, newdepth) for i in obj.args)})'
                Severity: Major
                Found in src/hunter/util.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return False
                  Severity: Major
                  Found in src/hunter/predicates.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return '{}([{}])'.format(
                    Severity: Major
                    Found in src/hunter/util.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return repr(obj)
                      Severity: Major
                      Found in src/hunter/util.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return False
                        Severity: Major
                        Found in src/hunter/predicates.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return False
                          Severity: Major
                          Found in src/hunter/event.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return '%s(%d, %d, %d, %d, tzinfo=%s%s)' % (
                            Severity: Major
                            Found in src/hunter/util.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return object.__repr__(obj)
                              Severity: Major
                              Found in src/hunter/util.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return '%s(%d, %d, %d, %d, %d, %d, %d, tzinfo=%s%s)' % (
                                Severity: Major
                                Found in src/hunter/util.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return repr(obj)
                                  Severity: Major
                                  Found in src/hunter/util.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return '%s({%s})' % (  # noqa: UP031
                                    Severity: Major
                                    Found in src/hunter/util.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return 're.compile(%s)' % safe_repr(obj.pattern)
                                      Severity: Major
                                      Found in src/hunter/util.py - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language