wamonite/packermate

View on GitHub

Showing 55 of 55 total issues

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

    def get_data(self):
        config_data_list = []

        path_list = self._path_list
        if self._initial_config:
Severity: Minor
Found in packermate/config.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 parse_provisioners has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def parse_provisioners(provisioner_list, config, packer_config):
    if not isinstance(provisioner_list, list):
        raise ProvisionerException('Provisioners must be a list')

    def to_expanded_json(val):
Severity: Minor
Found in packermate/provisioner.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 __setattr__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __setattr__(self, item, value):
        if item in ('_path_list', '_config', '_re', '_uuid_cache'):
            super(Config, self).__setattr__(item, value)

        else:
Severity: Minor
Found in packermate/config.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

Avoid deeply nested control flow statements.
Open

                            if insert_at is not None:
                                version_list.insert(insert_at, installed_version)

                            else:
                                version_list.append(installed_version)
Severity: Major
Found in packermate/vagrant.py - About 45 mins to fix

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

    def add_vagrant_files_to_box_metadata(config, box_metadata, target_file_lookup, box_inventory):
        for provider_name, provider_file_name in target_file_lookup.iteritems():
            if 'vagrant_publish_copy_command' in config:
                copy_published_file(config, provider_file_name, provider_name)
    
    
    Severity: Minor
    Found in packermate/vagrant.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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    if not isinstance(config_data['include_optional'], list):
                        raise ConfigLoadFormatException("Config file optional includes should contain a valid YAML list: {}".format(config_loader.names))
    Severity: Minor
    Found in packermate/config.py and 1 other location - About 40 mins to fix
    packermate/config.py on lines 580..581

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    if not isinstance(config_data['include'], list):
                        raise ConfigLoadFormatException("Config file includes should contain a valid YAML list: {}".format(config_loader.names))
    Severity: Minor
    Found in packermate/config.py and 1 other location - About 40 mins to fix
    packermate/config.py on lines 591..592

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 34.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        def __init__(self, config, data_dir, packer_config, temp_dir, box_inventory):
    Severity: Minor
    Found in packermate/target.py - About 35 mins to fix

      Function add_version has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def add_version(self, version, provider, url, checksum = None, checksum_type = None):
      Severity: Minor
      Found in packermate/vagrant.py - About 35 mins to fix

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

            def add_version(self, version, provider, url, checksum = None, checksum_type = None):
                version_val = parse_version(version)
        
                version_list = [val['version'] for val in self.versions]
                insert_at, match_at = get_version_index(version_val, version_list)
        Severity: Minor
        Found in packermate/vagrant.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 expand_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def expand_parameters(self, value):
                if isinstance(value, basestring):
                    config_value = ConfigValue(self, value = value, path_list = self._path_list)
                    return config_value.evaluate()
        
        
        Severity: Minor
        Found in packermate/config.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 _get_file_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_file_data(self, file_name, encode = True):
                data = None
                for file_name_full in get_path_names(file_name, self._path_list):
                    try:
                        with open(file_name_full, 'rb') as file_object:
        Severity: Minor
        Found in packermate/config.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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def build(self):
                packer_config = PackerConfig()
        
                with TempDir(self._config.temp_dir) as temp_dir_object:
                    temp_dir = temp_dir_object.path
        Severity: Minor
        Found in packermate/command.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 _evaluate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _evaluate(self):
                if self._value:
                    self._parse(self._value)
        
                    self._value = None
        Severity: Minor
        Found in packermate/config.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

        TODO found
        Open

        ; TODO fix flake8 issues!
        Severity: Minor
        Found in tox.ini by fixme
        Severity
        Category
        Status
        Source
        Language