getsentry/raven-python

View on GitHub

Showing 146 of 146 total issues

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

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

                        def get_host(environ):
                            """Return the real host for the given WSGI environment.  This takes care
                            of the `X-Forwarded-Host` header.
                        
                            :param environ: the WSGI environment to get the host of.
                        Severity: Minor
                        Found in raven/utils/wsgi.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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        try:
                            import gevent
                            # gevent 1.0bN renamed coros to lock
                            try:
                                from gevent.lock import Semaphore
                        Severity: Minor
                        Found in raven/transport/gevent.py and 1 other location - About 35 mins to fix
                        raven/transport/eventlet.py on lines 14..22

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 33.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                            def send_remote(self, url, data, headers=None):
                                # If the client is configured to raise errors on sending,
                                # the implication is that the backoff and retry strategies
                                # will be handled by the calling application
                                if headers is None:
                        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

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

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

                        def get_frame_locals(frame, transformer=transform, max_var_size=4096):
                            f_locals = getattr(frame, 'f_locals', None)
                            if not f_locals:
                                return None
                        
                        
                        Severity: Minor
                        Found in raven/utils/stacks.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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        try:
                            import eventlet
                            try:
                                from eventlet.green import urllib2 as eventlet_urllib2
                            except ImportError:
                        Severity: Minor
                        Found in raven/transport/eventlet.py and 1 other location - About 35 mins to fix
                        raven/transport/gevent.py on lines 13..22

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 33.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                            def set_dsn(self, dsn=None, transport=None):
                                if not dsn and os.environ.get('SENTRY_DSN'):
                                    msg = "Configuring Raven from environment variable 'SENTRY_DSN'"
                                    self.logger.debug(msg)
                                    dsn = os.environ['SENTRY_DSN']
                        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