lucasb/BakerCM

View on GitHub
baker/repository.py

Summary

Maintainability
A
2 hrs
Test Coverage

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

def download(url, target=None, force=False):
    """
    Download and storage file from a url
    """
    if not is_url(url):
Severity: Minor
Found in baker/repository.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def list(all_info=False):
        """
        List of recipes saved in index
        """
        recipes = Storage.json(settings.get('STORAGE_RECIPE_INDEX'))
Severity: Minor
Found in baker/repository.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

Function calc_length has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def calc_length(recipes):
        """
        Calculate size of values in index file
        """
        lengths = {'remote': 6, 'version': 7, 'filename': 8}
Severity: Minor
Found in baker/repository.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

Function _check_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_settings(self):
        """
        Verify if required settings is right to repository works
        """
        if not self.repository_url or not self.repository_type:
Severity: Minor
Found in baker/repository.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

There are no issues that match your filters.

Category
Status