rollbar/pyrollbar

View on GitHub

Showing 77 of 97 total issues

Function _build_request_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _build_request_data(request):
    """
    Returns a dictionary containing data from the request.
    """

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

    def redact(self, url_string):
        _redact = super(ScrubUrlTransform, self).redact

        missing_colon_double_slash = False

Severity: Minor
Found in rollbar/lib/transforms/scruburl.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 build_key_matcher has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def build_key_matcher(prefixes_or_suffixes, type='prefix', case_sensitive=False):
    _prefixes = []

    if type == 'prefix':
        _iter = iter
Severity: Minor
Found in rollbar/lib/__init__.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 _build_starlette_request_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _build_starlette_request_data(request):
    from starlette.datastructures import UploadFile

    request_data = {
        'url': str(request.url),
Severity: Minor
Found in rollbar/__init__.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 transform_custom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def transform_custom(self, o, key=None):
        if o is None:
            return None

        # Best to be very careful when we call user code in the middle of
Severity: Minor
Found in rollbar/lib/transforms/serializable.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 is_current_version_higher_or_equal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def is_current_version_higher_or_equal(current_version, min_version):
    """
    Compare two version strings and return True if the current version is higher or equal to the minimum version.

    Note: This function only compares the release segment of the version string.
Severity: Minor
Found in rollbar/contrib/fastapi/utils.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 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

          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

            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