saltstack/salt

View on GitHub
salt/states/zone.py

Summary

Maintainability
F
1 mo
Test Coverage

Function resource_present has a Cognitive Complexity of 167 (exceeds 5 allowed). Consider refactoring.
Open

def resource_present(name, resource_type, resource_selector_property, resource_selector_value, **kwargs):
    '''
    Ensure resource exists with provided properties

    name : string
Severity: Minor
Found in salt/states/zone.py - About 3 days 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 present has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
Open

def present(name, brand, zonepath, properties=None, resources=None):
    '''
    Ensure a zone with certain properties and resources

    name : string
Severity: Minor
Found in salt/states/zone.py - About 2 days 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

File zone.py has 1031 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Management of Solaris Zones

:maintainer:    Jorge Schrauwen <sjorge@blackdot.be>
Severity: Major
Found in salt/states/zone.py - About 2 days to fix

    Function export has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    def export(name, path, replace=False):
        '''
        Export a zones configuration
    
        name : string
    Severity: Minor
    Found in salt/states/zone.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 import_ has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

    def import_(name, path, mode='import', nodataset=False, brand_opts=None):
        '''
        Import a zones configuration
    
        name : string
    Severity: Minor
    Found in salt/states/zone.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 resource_absent has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

    def resource_absent(name, resource_type, resource_selector_property, resource_selector_value):
        '''
        Ensure resource is absent
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 6 hrs 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 absent has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    def absent(name, uninstall=False):
        '''
        Ensure a zone is absent
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 6 hrs 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

    Cyclomatic complexity is too high in function resource_present. (38)
    Open

    def resource_present(name, resource_type, resource_selector_property, resource_selector_value, **kwargs):
        '''
        Ensure resource exists with provided properties
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function present. (38)
    Open

    def present(name, brand, zonepath, properties=None, resources=None):
        '''
        Ensure a zone with certain properties and resources
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function property_absent has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def property_absent(name, property):
        '''
        Ensure property is absent
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 4 hrs 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 property_present has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def property_present(name, property, value):
        '''
        Ensure property has a certain value
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 3 hrs 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 halted has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def halted(name, graceful=True):
        '''
        Ensure zone is halted
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 2 hrs 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 booted has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def booted(name, single=False):
        '''
        Ensure zone is booted
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 2 hrs 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 installed has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def installed(name, nodataset=False, brand_opts=None):
        '''
        Ensure zone is installed
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 2 hrs 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 uninstalled has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def uninstalled(name):
        '''
        Ensure zone is uninstalled
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 2 hrs 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 attached has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def attached(name, force=False):
        '''
        Ensure zone is attached
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 2 hrs 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 detached has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def detached(name):
        '''
        Ensure zone is detached
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py - About 2 hrs 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

    Cyclomatic complexity is too high in function export. (22)
    Open

    def export(name, path, replace=False):
        '''
        Export a zones configuration
    
        name : string
    Severity: Minor
    Found in salt/states/zone.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Avoid deeply nested control flow statements.
    Open

                        if resource_selector_property:
                            ret['comment'] = 'the {0} resource {1} is up to date.'.format(
                                resource_type,
                                resource_selector_value,
                            )
    Severity: Major
    Found in salt/states/zone.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if resource_prune:
                              res = resource_absent(
                                  name,
                                  resource_cfg['resource_type'],
                                  resource_selector_property=resource_selector_property,
      Severity: Major
      Found in salt/states/zone.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for key in kwargs:
                                log.debug('zone.resource_preent - key=%s value=%s current_value=%s',
                                    key,
                                    resource[key] if key in resource else None,
                                    _parse_value(kwargs[key]),
        Severity: Major
        Found in salt/states/zone.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if mode.lower() == 'attach':
                                  res_attach = __salt__['zoneadm.attach'](name, False, brand_opts)
                                  ret['result'] = res_attach['status']
                                  if res_attach['status']:
                                      ret['changes'][name] = 'attached'
          Severity: Major
          Found in salt/states/zone.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if res:
                                    ret['result'] = ret['result'] if res['result'] else False
                                    ret['comment'].append(res['comment'])
                                    if res['changes']:
                                        if 'property' not in ret['changes']:
            Severity: Major
            Found in salt/states/zone.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if 'message' in res_uninstall:
                                      ret['comment'].append(res_uninstall['message'])
                                  ret['comment'] = "\n".join(ret['comment'])
              Severity: Major
              Found in salt/states/zone.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if isinstance(value, list):
                                        for respv in value:
                                            resource_cfg.update(dict(respv))
                
                
                Severity: Major
                Found in salt/states/zone.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if 'resource_prune' in resource_cfg:
                                          resource_prune = resource_cfg['resource_prune']
                                          del resource_cfg['resource_prune']
                                      if 'resource_selector_property' in resource_cfg:
                  Severity: Major
                  Found in salt/states/zone.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if not resource_selector_property and key in _zonecfg_resource_default_selectors:
                                            resource_selector_property = _zonecfg_resource_default_selectors[key]
                    
                    
                    Severity: Major
                    Found in salt/states/zone.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if ret['result'] is None:
                                              if __opts__['test']:
                                                  ret['result'] = True
                                              else:
                                                  ## update resource
                      Severity: Major
                      Found in salt/states/zone.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if res:
                                                ret['result'] = ret['result'] if res['result'] else False
                                                ret['comment'].append(res['comment'])
                                                if res['changes']:
                                                    if 'resource' not in ret['changes']:
                        Severity: Major
                        Found in salt/states/zone.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if resource_selector_property:
                                                  ret['changes'][resource_type][resource_selector_value][key] = _parse_value(kwargs[key])
                                              else:
                                                  ret['changes'][resource_type][key] = _parse_value(kwargs[key])
                                          if ret['comment'] == '':
                          Severity: Major
                          Found in salt/states/zone.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if 'message' in res_delete:
                                                    ret['comment'].append(res_delete['message'])
                                                ret['comment'] = "\n".join(ret['comment'])
                            Severity: Major
                            Found in salt/states/zone.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if zonecfg_res['status']:
                                                      ret['changes'][resource_type] = 'removed'
                                                      if ret['comment'] == '':
                                                          ret['comment'] = 'The {0} resource was removed.'.format(
                                                              resource_type,
                              Severity: Major
                              Found in salt/states/zone.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if __salt__['file.file_exists'](cfg_tmp):
                                                        __salt__['file.remove'](cfg_tmp)
                                                else:
                                Severity: Major
                                Found in salt/states/zone.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if 'message' in res_detach:
                                                          ret['comment'].append(res_detach['message'])
                                                      ret['comment'] = "\n".join(ret['comment'])
                                  Severity: Major
                                  Found in salt/states/zone.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if replace:
                                                            try:
                                                                __salt__['file.move'](cfg_tmp, path)
                                                            except CommandExecutionError:
                                                                if __salt__['file.file_exists'](cfg_tmp):
                                    Severity: Major
                                    Found in salt/states/zone.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if mode.lower() == 'install':
                                                              res_install = __salt__['zoneadm.install'](name, nodataset, brand_opts)
                                                              ret['result'] = res_install['status']
                                                              if res_install['status']:
                                                                  ret['changes'][name] = 'installed'
                                      Severity: Major
                                      Found in salt/states/zone.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            if 'resource_selector_property' in resource_cfg:
                                                                resource_selector_property = resource_cfg['resource_selector_property']
                                                                del resource_cfg['resource_selector_property']
                                                            if not resource_selector_property and key in _zonecfg_resource_default_selectors:
                                        Severity: Major
                                        Found in salt/states/zone.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                              if not value:
                                                                  res = property_absent(name, key)
                                                              elif value:
                                                                  res = property_present(name, key, value)
                                                              if res:
                                          Severity: Major
                                          Found in salt/states/zone.py - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                if zonecfg_res['status']:
                                                                    ret['changes'][resource_type] = {}
                                                                    ret['changes'][resource_type][resource_selector_value] = 'removed'
                                                                    if ret['comment'] == '':
                                                                        ret['comment'] = 'The {0} resource {1} was removed.'.format(
                                            Severity: Major
                                            Found in salt/states/zone.py - About 45 mins to fix

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

                                              def detached(name):
                                                  '''
                                                  Ensure zone is detached
                                              
                                                  name : string
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 2 days to fix
                                              salt/states/zone.py on lines 1185..1223

                                              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 320.

                                              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

                                              def uninstalled(name):
                                                  '''
                                                  Ensure zone is uninstalled
                                              
                                                  name : string
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 2 days to fix
                                              salt/states/zone.py on lines 1100..1138

                                              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 320.

                                              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 mode.lower() == 'attach':
                                                                      res_attach = __salt__['zoneadm.attach'](name, False, brand_opts)
                                                                      ret['result'] = res_attach['status']
                                                                      if res_attach['status']:
                                                                          ret['changes'][name] = 'attached'
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 day to fix
                                              salt/states/zone.py on lines 813..830

                                              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 181.

                                              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 mode.lower() == 'install':
                                                                      res_install = __salt__['zoneadm.install'](name, nodataset, brand_opts)
                                                                      ret['result'] = res_install['status']
                                                                      if res_install['status']:
                                                                          ret['changes'][name] = 'installed'
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 day to fix
                                              salt/states/zone.py on lines 795..812

                                              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 181.

                                              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 ret['result']:
                                                              res_delete = __salt__['zonecfg.delete'](name)
                                                              ret['result'] = res_delete['status']
                                                              if ret['result']:
                                                                  ret['changes'][name] = 'deleted'
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 day to fix
                                              salt/states/zone.py on lines 1027..1038

                                              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 164.

                                              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

                                                          elif zones[name]['state'] == 'installed':
                                                              res_detach = __salt__['zoneadm.detach'](name)
                                                              ret['result'] = res_detach['status']
                                                              if ret['result']:
                                                                  ret['changes'][name] = 'detached'
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 day to fix
                                              salt/states/zone.py on lines 1039..1050

                                              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 164.

                                              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 res:
                                                                      ret['result'] = ret['result'] if res['result'] else False
                                                                      ret['comment'].append(res['comment'])
                                                                      if res['changes']:
                                                                          if 'resource' not in ret['changes']:
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 day to fix
                                              salt/states/zone.py on lines 930..936

                                              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 137.

                                              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 res:
                                                                      ret['result'] = ret['result'] if res['result'] else False
                                                                      ret['comment'].append(res['comment'])
                                                                      if res['changes']:
                                                                          if 'property' not in ret['changes']:
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 day to fix
                                              salt/states/zone.py on lines 977..983

                                              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 137.

                                              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 __salt__['file.file_exists'](path):
                                                              ## move cfg_tmp to path
                                                              try:
                                                                  __salt__['file.move'](cfg_tmp, path)
                                                              except CommandExecutionError:
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 7 hrs to fix
                                              salt/states/zone.py on lines 694..711

                                              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 124.

                                              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 replace:
                                                                      try:
                                                                          __salt__['file.move'](cfg_tmp, path)
                                                                      except CommandExecutionError:
                                                                          if __salt__['file.file_exists'](cfg_tmp):
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 7 hrs to fix
                                              salt/states/zone.py on lines 664..682

                                              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 124.

                                              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 3 locations. Consider refactoring.
                                              Open

                                                  if name in zones:
                                                      ## zone exists
                                                      if zones[name]['state'] == 'running':
                                                          ## zone is running
                                                          ret['result'] = True
                                              Severity: Major
                                              Found in salt/states/zone.py and 2 other locations - About 6 hrs to fix
                                              salt/states/zone.py on lines 587..620
                                              salt/states/zone.py on lines 643..736

                                              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 117.

                                              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 3 locations. Consider refactoring.
                                              Open

                                                  if name in zones:
                                                      ## zone exists
                                                      if zones[name]['state'] != 'running':
                                                          ## zone is not running
                                                          ret['result'] = True
                                              Severity: Major
                                              Found in salt/states/zone.py and 2 other locations - About 6 hrs to fix
                                              salt/states/zone.py on lines 533..566
                                              salt/states/zone.py on lines 643..736

                                              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 117.

                                              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 3 locations. Consider refactoring.
                                              Open

                                                  if name in zones:
                                                      ## zone exists
                                                      if __opts__['test']:
                                                          ## pretend we did the correct thing
                                                          ret['result'] = True
                                              Severity: Major
                                              Found in salt/states/zone.py and 2 other locations - About 6 hrs to fix
                                              salt/states/zone.py on lines 533..566
                                              salt/states/zone.py on lines 587..620

                                              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 117.

                                              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

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

                                                                          for key in kwargs if ret['result'] else []:
                                                                              if resource_selector_property:
                                                                                  ret['changes'][resource_type][resource_selector_value][key] = _parse_value(kwargs[key])
                                                                              else:
                                                                                  ret['changes'][resource_type][key] = _parse_value(kwargs[key])
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 5 hrs to fix
                                              salt/states/zone.py on lines 394..398

                                              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 95.

                                              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

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

                                                              for key in kwargs if ret['result'] else []:
                                                                  if resource_selector_property:
                                                                      ret['changes'][resource_type][resource_selector_value][key] = _parse_value(kwargs[key])
                                                                  else:
                                                                      ret['changes'][resource_type][key] = _parse_value(kwargs[key])
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 5 hrs to fix
                                              salt/states/zone.py on lines 352..356

                                              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 95.

                                              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 __opts__['test'] or zoneadm_res['status']:
                                                              ret['result'] = True
                                                              ret['changes'][name] = 'halted'
                                                              ret['comment'] = 'Zone {0} halted'.format(name)
                                                          else:
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 5 hrs to fix
                                              salt/states/zone.py on lines 543..549

                                              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 95.

                                              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 __opts__['test'] or zoneadm_res['status']:
                                                              ret['result'] = True
                                                              ret['changes'][name] = 'booted'
                                                              ret['comment'] = 'Zone {0} booted'.format(name)
                                                          else:
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 5 hrs to fix
                                              salt/states/zone.py on lines 597..603

                                              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 95.

                                              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 ret['comment'] == '':
                                                                              if resource_selector_property:
                                                                                  ret['comment'] = 'The {0} resource {1} was updated.'.format(
                                                                                      resource_type,
                                                                                      resource_selector_value,
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 hr to fix
                                              salt/states/zone.py on lines 348..374

                                              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 56.

                                              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 ret['result']:
                                                                          ret['changes'][resource_type] = {}
                                                                          if resource_selector_property:
                                                                              ret['changes'][resource_type][resource_selector_value] = {}
                                                                          for key in kwargs if ret['result'] else []:
                                              Severity: Major
                                              Found in salt/states/zone.py and 1 other location - About 1 hr to fix
                                              salt/states/zone.py on lines 357..364

                                              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 56.

                                              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 property not in zonecfg_new:
                                                                  ret['changes'][property] = None
                                                              elif zonecfg[property] != zonecfg_new[property]:
                                                                  ret['changes'][property] = zonecfg_new[property]
                                              Severity: Minor
                                              Found in salt/states/zone.py and 1 other location - About 55 mins to fix
                                              salt/states/user.py on lines 675..677

                                              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 45.

                                              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 zonecfg_res['status']:
                                                                      ret['changes'][resource_type] = 'removed'
                                                                      if ret['comment'] == '':
                                                                          ret['comment'] = 'The {0} resource was removed.'.format(
                                                                              resource_type,
                                              Severity: Minor
                                              Found in salt/states/zone.py and 1 other location - About 55 mins to fix
                                              salt/states/zpool.py on lines 369..375

                                              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 45.

                                              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

                                              def __virtual__():
                                                  '''
                                                  Provides zone state on Solaris
                                                  '''
                                                  if 'zonecfg.create' in __salt__ and 'zoneadm.install' in __salt__:
                                              Severity: Minor
                                              Found in salt/states/zone.py and 1 other location - About 50 mins to fix
                                              salt/states/smartos.py on lines 136..145

                                              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 44.

                                              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

                                              There are no issues that match your filters.

                                              Category
                                              Status