lucasb/BakerCM

View on GitHub

Showing 15 of 15 total issues

Function dict_from_ini has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def dict_from_ini(self):
        """
        Load instruction from a recipe with ini format
        """
        self.parser = configparser.ConfigParser()
Severity: Minor
Found in baker/recipe.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_cli has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _build_cli(commands):
        """
        Build command line interface options for baker commands with help instructions
        """
        description = 'Baker is a decentralized configuration management based on files. <:::>'
Severity: Minor
Found in baker/cli.py - About 1 hr to fix

    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 _load_bakerc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _load_bakerc():
        """
        Load settings from bakerc file
        """
        def convert_if_bool(string):
    Severity: Minor
    Found in baker/settings.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 replace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def replace(self):
            """
            Replace variables in template file based on recipe instructions
            """
            for instruction in self.instructions:
    Severity: Minor
    Found in baker/template.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 values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def values(custom_only=False):
        """
        List of settings custom and defaults
        """
        if custom_only and Path(_BAKERC_PATH).is_file():
    Severity: Minor
    Found in baker/settings.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(args):
            """
            Run a recipe from local path or get it from repository
            """
            if args.name and not args.path:
    Severity: Minor
    Found in baker/commands.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 ignore_case_substitute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def ignore_case_substitute(self, mapping):
            """
            Substitution of values in replace ignoring case sensitive of variables
            """
            if not mapping:
    Severity: Minor
    Found in baker/template.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 _add_file_permission has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _add_file_permission(instruction, path):
            """
            Add permission and owner for templates files after replace
            """
            if hasattr(instruction, 'user') or hasattr(instruction, 'group'):
    Severity: Minor
    Found in baker/template.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 update_secrets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_secrets(self):
            """
            Replace secret values with encrypt values in recipe
            """
            for instruction in self.instructions:
    Severity: Minor
    Found in baker/recipe.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 _template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _template(self, template):
            """
            Validate and structure template attributes
            """
            self.__setattr__('is_remote', False)
    Severity: Minor
    Found in baker/recipe.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 encrypt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def encrypt(args):
            """
            Encrypt values from recipe file or list of strings
            """
            secret_key = str(SecretKey().key)
    Severity: Minor
    Found in baker/commands.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 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 _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

    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

    Severity
    Category
    Status
    Source
    Language