getsentry/raven-python

View on GitHub

Showing 104 of 146 total issues

Avoid deeply nested control flow statements.
Open

                    if _dnsname_match(value, hostname):
                        return
                    dnsnames.append(value)
Severity: Major
Found in raven/utils/ssl_match_hostname.py - About 45 mins to fix

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

        def __init__(self, *args, **kwargs):
            if len(args) == 1:
                arg = args[0]
                if isinstance(arg, string_types):
                    self.client = kwargs.pop('client_cls', Client)(dsn=arg, **kwargs)
    Severity: Minor
    Found in raven/handlers/logbook.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 report has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def report(request, project_id=None):
        if request.method == 'OPTIONS':
            return HttpResponse()
    
        if request.method == 'POST':
    Severity: Minor
    Found in raven/contrib/django/views.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 record_sql has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def record_sql(vendor, alias, start, duration, sql, params):
    Severity: Minor
    Found in raven/contrib/django/client.py - About 45 mins to fix

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

      def get_host(request):
          """
          A reimplementation of Django's get_host, without the
          SuspiciousOperation check.
          """
      Severity: Minor
      Found in raven/contrib/django/utils.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 async_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def async_send(self, url, data, headers, success_cb, failure_cb):
      Severity: Minor
      Found in raven/transport/gevent.py - About 35 mins to fix

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

            def record_many_sql(vendor, alias, start, sql, param_list):
        Severity: Minor
        Found in raven/contrib/django/client.py - About 35 mins to fix

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

              def async_send(self, url, data, headers, success_cb, failure_cb):
          Severity: Minor
          Found in raven/transport/threaded_requests.py - About 35 mins to fix

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

            def get_lines_from_file(filename, lineno, context_lines,
            Severity: Minor
            Found in raven/utils/stacks.py - About 35 mins to fix

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

                  def init_app(self, app, dsn=None, logging=None, level=None,
              Severity: Minor
              Found in raven/contrib/sanic.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 async_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def async_send(self, url, data, headers, success_cb, failure_cb):
                  Severity: Minor
                  Found in raven/transport/twisted.py - About 35 mins to fix

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

                        def async_send(self, url, data, headers, success_cb, failure_cb):
                    Severity: Minor
                    Found in raven/transport/threaded.py - About 35 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 async_send has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def async_send(self, url, data, headers, success_cb, failure_cb):
                        Severity: Minor
                        Found in raven/transport/tornado.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 send_sync has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def send_sync(self, url, data, headers, success_cb, failure_cb):
                            Severity: Minor
                            Found in raven/transport/threaded.py - About 35 mins to fix

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

                                  def async_send(self, url, data, headers, success_cb, error_cb):
                              Severity: Minor
                              Found in raven/transport/base.py - About 35 mins to fix

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

                                    def send_sync(self, url, data, headers, success_cb, failure_cb):
                                Severity: Minor
                                Found in raven/transport/threaded_requests.py - About 35 mins to fix

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

                                      def capture(self, event_type, data=None, date=None, time_spent=None,
                                                  extra=None, stack=None, tags=None, sample_rate=None,
                                                  **kwargs):
                                          """
                                          Captures and processes an event and pipes it off to SentryClient.send.
                                  Severity: Minor
                                  Found in raven/base.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language