closeio/limitlion

View on GitHub

Showing 5 of 7 total issues

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

def _validate_throttle(key, params):
    check_values_pipe = redis.pipeline()
    for param, param_name in params:
        if param is not None:
            # Throttle values can only be positive floats
Severity: Minor
Found in limitlion/throttle.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 throttle has 6 arguments (exceeds 5 allowed). Consider refactoring.
Open

def throttle(
Severity: Minor
Found in limitlion/throttle.py - About 35 mins to fix

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

        def __init__(
    Severity: Minor
    Found in limitlion/running_counter.py - About 35 mins to fix

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

          def _get_name(self, name):
              if self.name:
                  if name and self.name != name:
                      raise ValueError(
                          'Cannot specify different name when already set in __init__'
      Severity: Minor
      Found in limitlion/running_counter.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 throttle_wait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def throttle_wait(name, *args, **kwargs):
          """Sleeps time specified by throttle if needed.
      
          This will wait potentially forever to get permission to do work
      
      
      Severity: Minor
      Found in limitlion/throttle.py - About 25 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