ionelmc/python-hunter

View on GitHub

Showing 67 of 67 total issues

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/predicates.py - About 30 mins to fix

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

          def stdlib(self):
              """
              A boolean flag. ``True`` if frame is in stdlib.
      
              :type: bool
      Severity: Minor
      Found in src/hunter/event.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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __call__(self, event):
              """
              Handle event and print filename, line number and source code. If event.kind is a `return` or `exception` also
              prints values.
              """
      Severity: Minor
      Found in src/hunter/actions.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 get_func_in_mro has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_func_in_mro(obj, code):
          """Attempt to find a function in a side-effect free way.
      
          This looks in obj's mro manually and does not invoke any descriptors.
          """
      Severity: Minor
      Found in src/hunter/util.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 trace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def trace(*predicates, **options):
          """
          Starts tracing. Can be used as a context manager (with slightly incorrect semantics - it starts tracing
          before ``__enter__`` is called).
      
      
      Severity: Minor
      Found in src/hunter/__init__.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 filename_prefix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def filename_prefix(self, event=None):
              """
              Get an aligned and trimmed filename prefix for the given ``event``.
      
              Returns: string
      Severity: Minor
      Found in src/hunter/actions.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