getsentry/raven-python

View on GitHub
raven/breadcrumbs.py

Summary

Maintainability
C
1 day
Test Coverage

File breadcrumbs.py has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import absolute_import

import os
import logging

Severity: Minor
Found in raven/breadcrumbs.py - About 3 hrs to fix

    Function get_buffer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_buffer(self):
            rv = []
            for idx, (payload, processor) in enumerate(self.buffer):
                if processor is not None:
                    try:
    Severity: Minor
    Found in raven/breadcrumbs.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 _record_log_breadcrumb has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def _record_log_breadcrumb(logger, level, msg, *args, **kwargs):
        for handler in special_logging_handlers:
            if handler(logger, level, msg, args, kwargs):
                return
    
    
    Severity: Minor
    Found in raven/breadcrumbs.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 _install_httplib has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def _install_httplib():
        try:
            from httplib import HTTPConnection
        except ImportError:
            from http.client import HTTPConnection
    Severity: Minor
    Found in raven/breadcrumbs.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 record has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def record(self, timestamp=None, level=None, message=None,
    Severity: Major
    Found in raven/breadcrumbs.py - About 50 mins to fix

      Function record has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def record(message=None, timestamp=None, level=None, category=None,
      Severity: Major
      Found in raven/breadcrumbs.py - About 50 mins to fix

        Function putrequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def putrequest(self, method, url, *args, **kwargs):
        Severity: Minor
        Found in raven/breadcrumbs.py - About 35 mins to fix

          Function _record_log_breadcrumb has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _record_log_breadcrumb(logger, level, msg, *args, **kwargs):
          Severity: Minor
          Found in raven/breadcrumbs.py - About 35 mins to fix

            Function handler has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def handler(logger, level, msg, args, kwargs):
            Severity: Minor
            Found in raven/breadcrumbs.py - About 35 mins to fix

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

              def _hook_requests():
                  try:
                      from requests.sessions import Session
                  except ImportError:
                      return
              Severity: Minor
              Found in raven/breadcrumbs.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

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

              def _wrap_logging_method(meth, level=None):
                  if not isinstance(meth, FunctionType):
                      func = meth.im_func
                  else:
                      func = meth
              Severity: Minor
              Found in raven/breadcrumbs.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

              There are no issues that match your filters.

              Category
              Status