yafeunteun/nutripy

View on GitHub

Showing 3 of 94 total issues

Function get_new_state has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

def get_new_state(age, height, gender, activity, goal, weight_history, phases_history, tdci, tdee):
    
    assert len(weight_history) == len(phases_history), \
    "weight history should have the same length as phase history"

Severity: Minor
Found in nutripy/diet.py - About 1 day 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_new_state has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_new_state(age, height, gender, activity, goal, weight_history, phases_history, tdci, tdee):
Severity: Major
Found in nutripy/diet.py - About 1 hr to fix

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

        def get_daily_needs(self, age, weight, height, gender, activity, goal):
    Severity: Minor
    Found in nutripy/nutripy.py - About 45 mins to fix
      Severity
      Category
      Status
      Source
      Language