netdata/netdata

View on GitHub
src/collectors/python.d.plugin/python_modules/urllib3/util/retry.py

Summary

Maintainability
C
1 day
Test Coverage

Function increment has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def increment(self, method=None, url=None, response=None, error=None,
                  _pool=None, _stacktrace=None):
        """ Return a new Retry object with incremented retry counters.

        :param response: A response object, or None, if the server did not
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/urllib3/util/retry.py - About 3 hrs 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

File retry.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT
from __future__ import absolute_import
import time
import logging
from collections import namedtuple
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/urllib3/util/retry.py - About 3 hrs to fix

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

        def __init__(self, total=10, connect=None, read=None, redirect=None, status=None,
    Severity: Major
    Found in src/collectors/python.d.plugin/python_modules/urllib3/util/retry.py - About 1 hr to fix

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

          def increment(self, method=None, url=None, response=None, error=None,
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/urllib3/util/retry.py - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status