getsentry/raven-python

View on GitHub

Showing 104 of 146 total issues

Function init_app has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def init_app(self, app, dsn=None, logging=None, level=None,
                 logging_exclusions=None):
        if dsn is not None:
            self.dsn = dsn

Severity: Minor
Found in raven/contrib/sanic.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 urlopen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def urlopen(url, data=None, timeout=defaults.TIMEOUT, ca_certs=None,
            verify_ssl=False, assert_hostname=None):

    class ValidHTTPSConnection(httplib.HTTPConnection):
        default_port = httplib.HTTPS_PORT
Severity: Minor
Found in raven/utils/http.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 capture has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def capture(self, *args, **kwargs):
        if 'data' not in kwargs:
            kwargs['data'] = data = {}
        else:
            data = kwargs['data']
Severity: Minor
Found in raven/contrib/awslambda/__init__.py - About 55 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 varmap has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def varmap(func, var, context=None, name=None):
    """
    Executes ``func(key_name, value)`` on all values
    recurisively discovering dict and list scoped
    values.
Severity: Minor
Found in raven/utils/basic.py - About 55 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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, app, client=None, client_cls=Client, dsn=None,
Severity: Major
Found in raven/contrib/sanic.py - About 50 mins to fix

    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 init_app has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def init_app(self, app, dsn=None, logging=None, level=None,
      Severity: Major
      Found in raven/contrib/flask.py - About 50 mins to fix

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

            def process_logger_event(sender, logger, loglevel, logfile, format,
        Severity: Major
        Found in raven/contrib/celery/__init__.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, base_url=None, project=None, public_key=None,
            Severity: Minor
            Found in raven/conf/remote.py - About 45 mins to fix

              Function send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def send(self, url, data, headers):
                      """
                      Sends a request to a remote webserver using HTTP POST.
                      """
                      req = urllib2.Request(url, headers=headers)
              Severity: Minor
              Found in raven/transport/http.py - About 45 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_current_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_current_url(environ, root_only=False, strip_querystring=False,
                                  host_only=False):
                  """A handy helper function that recreates the full URL for the current
                  request or parts of it.  Here an example:
              
              
              Severity: Minor
              Found in raven/utils/wsgi.py - About 45 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 _dnsname_match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def _dnsname_match(dn, hostname, max_wildcards=1):
                  """Matching according to RFC 6125, section 6.4.3
              
                  http://tools.ietf.org/html/rfc6125#section-6.4.3
                  """
              Severity: Minor
              Found in raven/utils/ssl_match_hostname.py - About 45 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 transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def transform(self, value, **kwargs):
                      """
                      Primary function which handles recursively transforming
                      values via their serializers
                      """
              Severity: Minor
              Found in raven/utils/serializer/manager.py - About 45 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 default has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def default(self, obj):
                      obj_type = type(obj)
                      if obj_type not in self.ENCODER_BY_TYPE and is_namedtuple(obj):
                          obj_type = collections.namedtuple
              
              
              Severity: Minor
              Found in raven/utils/json.py - About 45 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_auth_header has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def get_auth_header(protocol, timestamp, client, api_key,
              Severity: Minor
              Found in raven/utils/__init__.py - About 45 mins to fix

                Function urlopen has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def urlopen(url, data=None, timeout=defaults.TIMEOUT, ca_certs=None,
                Severity: Minor
                Found in raven/utils/http.py - About 45 mins to fix

                  Function process_failure_signal has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def process_failure_signal(self, sender, task_id, args, kwargs, einfo, **kw):
                  Severity: Minor
                  Found in raven/contrib/celery/__init__.py - About 45 mins to fix

                    Function merge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def merge(self, data, activate=True):
                            if activate:
                                self.activate()
                            d = self.data
                            for key, value in iteritems(data):
                    Severity: Minor
                    Found in raven/context.py - About 45 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 deeply nested control flow statements.
                    Open

                                        if line and line[:1] not in ('#', '^'):
                                            try:
                                                revision, ref = line.split(' ', 1)
                                            except ValueError:
                                                continue
                    Severity: Major
                    Found in raven/versioning.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language