rollbar/pyrollbar

View on GitHub

Showing 97 of 97 total issues

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

            if not SETTINGS['capture_username'] and 'username' in person_data:
                person_data['username'] = None
Severity: Minor
Found in rollbar/__init__.py and 1 other location - About 50 mins to fix
rollbar/__init__.py on lines 926..927

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 36.

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

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

def undecodable_object_label(data):
    return '<Undecodable type:(%s) base64:(%s)>' % (type(data).__name__,
                                                    base64.b64encode(data).decode('ascii'))
Severity: Minor
Found in rollbar/lib/__init__.py and 1 other location - About 50 mins to fix
rollbar/lib/__init__.py on lines 145..147

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 36.

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

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

            if not SETTINGS['capture_email'] and 'email' in person_data:
                person_data['email'] = None
Severity: Minor
Found in rollbar/__init__.py and 1 other location - About 50 mins to fix
rollbar/__init__.py on lines 924..925

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 36.

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

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

def unencodable_object_label(data):
    return '<Unencodable type:(%s) base64:(%s)>' % (type(data).__name__,
                                                    base64.b64encode(data).decode('ascii'))
Severity: Minor
Found in rollbar/lib/__init__.py and 1 other location - About 50 mins to fix
rollbar/lib/__init__.py on lines 150..152

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 36.

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

    def __init__(self,
Severity: Minor
Found in rollbar/logger.py - About 45 mins to fix

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

    def report_exc_info(exc_info=None, request=None, extra_data=None, payload_data=None, level=None, **kw):
    Severity: Minor
    Found in rollbar/__init__.py - About 45 mins to fix

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

          def __init__(self,
      Severity: Minor
      Found in rollbar/lib/transforms/scruburl.py - About 45 mins to fix

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

            def transform_dict(self, o, key=None):
                ret = {}
                for k, v in o.items():
                    if isinstance(k, string_types) or isinstance(k, binary_type):
                        if isinstance(k, bytes):
        Severity: Minor
        Found in rollbar/lib/transforms/serializable.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

                                for i, arg in enumerate(temp_varargs):
                                    temp_varargs[i] = REDACT_REF
        
        
        Severity: Major
        Found in rollbar/__init__.py - About 45 mins to fix

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

                      rollbar.report_exc_info(
                          sys.exc_info(),
                          request,
                          extra_data=self.get_extra_data(request, exc),
                          payload_data=self.get_payload_data(request, exc),
          Severity: Minor
          Found in rollbar/contrib/django/middleware.py and 1 other location - About 45 mins to fix
          rollbar/contrib/django/middleware.py on lines 298..302

          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 35.

          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 _add_person_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def _add_person_data(data, request):
              try:
                  person_data = _build_person_data(request)
              except Exception as e:
                  log.exception("Exception while building person data for Rollbar payload: %r", e)
          Severity: Minor
          Found in rollbar/__init__.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, access_token, path, page_num, params, data, endpoint=None):
          Severity: Minor
          Found in rollbar/__init__.py - About 45 mins to fix

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

                    rollbar.report_exc_info(
                        sys.exc_info(),
                        request,
                        extra_data=self.get_extra_data(request, exc),
                        payload_data=self.get_payload_data(request, exc),
            Severity: Minor
            Found in rollbar/contrib/django/middleware.py and 1 other location - About 45 mins to fix
            rollbar/contrib/django/middleware.py on lines 330..334

            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 35.

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

            def search_items(title, return_fields=None, access_token=None, endpoint=None, **search_fields):
            Severity: Minor
            Found in rollbar/__init__.py - About 35 mins to fix

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

              def init(access_token, environment='production', scrub_fields=None, url_fields=None, **kw):
              Severity: Minor
              Found in rollbar/__init__.py - About 35 mins to fix

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

                def do_transform(transform, type_name, val, key=None, **kw):
                Severity: Minor
                Found in rollbar/lib/transforms/batched.py - About 35 mins to fix

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

                  def _report_exc_info(exc_info, request, extra_data, payload_data, level=None):
                  Severity: Minor
                  Found in rollbar/__init__.py - About 35 mins to fix

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

                    def _report_message(message, level, request, extra_data, payload_data):
                    Severity: Minor
                    Found in rollbar/__init__.py - About 35 mins to fix

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

                      def _parse_response(path, access_token, params, resp, endpoint=None):
                      Severity: Minor
                      Found in rollbar/__init__.py - About 35 mins to fix

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

                        def report_message(message, level='error', request=None, extra_data=None, payload_data=None):
                        Severity: Minor
                        Found in rollbar/__init__.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language