saltstack/salt

View on GitHub
salt/modules/debian_ip.py

Summary

Maintainability
F
1 mo
Test Coverage

File debian_ip.py has 1555 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The networking module for Debian-based distros

References:
Severity: Major
Found in salt/modules/debian_ip.py - About 4 days to fix

    Function _parse_interfaces has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_interfaces(interface_files=None):
        '''
        Parse /etc/network/interfaces and return current configured interfaces
        '''
        if interface_files is None:
    Severity: Minor
    Found in salt/modules/debian_ip.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

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

    def _parse_settings_eth(opts, iface_type, enabled, iface):
        '''
        Filters given options and outputs valid settings for a
        network interface.
        '''
    Severity: Minor
    Found in salt/modules/debian_ip.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 build_network_settings has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    def build_network_settings(**settings):
        '''
        Build the global network script.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_bridge_opts has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_bridge_opts(opts, iface):
        '''
        Filters given options and outputs valid settings for BRIDGING_OPTS
        If an option has a value that is not expected, this
        function will log the Interface, Setting and what was expected.
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 5 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 _parse_interfaces. (45)
    Open

    def _parse_interfaces(interface_files=None):
        '''
        Parse /etc/network/interfaces and return current configured interfaces
        '''
        if interface_files is None:
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_settings_bond_4 has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_bond_4(opts, iface, bond_def):
        '''
        Filters given options and outputs valid settings for bond4.
        If an option has a value that is not expected, this
        function will log what the Interface, Setting and what it was
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_settings_bond_2 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_bond_2(opts, iface, bond_def):
        '''
        Filters given options and outputs valid settings for bond2.
        If an option has a value that is not expected, this
        function will log what the Interface, Setting and what it was
    Severity: Minor
    Found in salt/modules/debian_ip.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

    Cyclomatic complexity is too high in function _parse_settings_eth. (32)
    Open

    def _parse_settings_eth(opts, iface_type, enabled, iface):
        '''
        Filters given options and outputs valid settings for a
        network interface.
        '''
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_settings_bond_0 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_bond_0(opts, iface, bond_def):
        '''
        Filters given options and outputs valid settings for bond0.
        If an option has a value that is not expected, this
        function will log what the Interface, Setting and what it was
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_ethtool_opts has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_ethtool_opts(opts, iface):
        '''
        Filters given options and outputs valid settings for ETHTOOLS_OPTS
        If an option has a value that is not expected, this
        function will log what the Interface, Setting and what it was
    Severity: Minor
    Found in salt/modules/debian_ip.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 build_interface has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def build_interface(iface, iface_type, enabled, **settings):
        '''
        Build an interface script for a network interface.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/debian_ip.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 _write_file_ifaces has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _write_file_ifaces(iface, data, **settings):
        '''
        Writes a file to disk
        '''
        try:
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_settings_bond_1 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_bond_1(opts, iface, bond_def):
    
        '''
        Filters given options and outputs valid settings for bond1.
        If an option has a value that is not expected, this
    Severity: Minor
    Found in salt/modules/debian_ip.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 build_network_settings. (23)
    Open

    def build_network_settings(**settings):
        '''
        Build the global network script.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_network_settings has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_network_settings(opts, current):
        '''
        Filters given options and outputs valid settings for
        the global network settings file.
        '''
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Cyclomatic complexity is too high in function _parse_bridge_opts. (21)
    Open

    def _parse_bridge_opts(opts, iface):
        '''
        Filters given options and outputs valid settings for BRIDGING_OPTS
        If an option has a value that is not expected, this
        function will log the Interface, Setting and what was expected.
    Severity: Minor
    Found in salt/modules/debian_ip.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 _parse_settings_bond_6 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_bond_6(opts, iface, bond_def):
    
        '''
        Filters given options and outputs valid settings for bond6.
        If an option has a value that is not expected, this
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _parse_settings_bond_5 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_bond_5(opts, iface, bond_def):
    
        '''
        Filters given options and outputs valid settings for bond5.
        If an option has a value that is not expected, this
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    def _parse_settings_bond_3(opts, iface, bond_def):
    
        '''
        Filters given options and outputs valid settings for bond3.
        If an option has a value that is not expected, this
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _parse_ethtool_pppoe_opts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_ethtool_pppoe_opts(opts, iface):
        '''
        Filters given options and outputs valid settings for ETHTOOLS_PPPOE_OPTS
        If an option has a value that is not expected, this
        function will log what the Interface, Setting and what it was
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get_network_settings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_network_settings():
        '''
        Return the contents of the global network script.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/debian_ip.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    def _parse_settings_bond(opts, iface):
        '''
        Filters given options and outputs valid settings for requested
        operation. If an option has a value that is not expected, this
        function will log what the Interface, Setting and what it was
    Severity: Minor
    Found in salt/modules/debian_ip.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 opt in adapters[iface_name]['data'][inet]:
                            opt_keys = sorted(adapters[iface_name]['data'][inet][opt].keys())
                            adapters[iface_name]['data'][inet][opt + '_keys'] = opt_keys
    
    
    Severity: Major
    Found in salt/modules/debian_ip.py - About 45 mins to fix

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

      def apply_network_settings(**settings):
          '''
          Apply global network configuration.
      
          CLI Example:
      Severity: Minor
      Found in salt/modules/debian_ip.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 _attrmaps_contain_attr(attr):
                              if '-' in attr:
                                  attrname = attr.replace('-', '_')
                              else:
                                  attrname = attr
      Severity: Major
      Found in salt/modules/debian_ip.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if 'data' not in adapters['source']:
                                adapters['source']['data'] = salt.utils.odict.OrderedDict()
                                adapters['source']['data']['sources'] = []
                            adapters['source']['data']['sources'].append(line.split()[1])
        Severity: Major
        Found in salt/modules/debian_ip.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if bond['arp_ip_target']:
                                  bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
                              else:
                                  bond['arp_ip_target'] = ip
                      else:
          Severity: Major
          Found in salt/modules/debian_ip.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for word in line.split()[1:]:
                                    if word not in adapters:
                                        adapters[word] = salt.utils.odict.OrderedDict()
                                    adapters[word]['enabled'] = True
            
            
            Severity: Major
            Found in salt/modules/debian_ip.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  for word in line.split()[1:]:
                                      if word not in adapters:
                                          adapters[word] = salt.utils.odict.OrderedDict()
                                      adapters[word]['hotplug'] = True
              
              
              Severity: Major
              Found in salt/modules/debian_ip.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if 'source' not in adapters:
                                        adapters['source'] = salt.utils.odict.OrderedDict()
                
                                    # Create item in dict, if not already there
                                    if 'data' not in adapters['source']:
                Severity: Major
                Found in salt/modules/debian_ip.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if len(sline) != 4:
                                          msg = 'Interface file malformed: {0}.'
                                          msg = msg.format(sline)
                                          log.error(msg)
                                          raise AttributeError(msg)
                  Severity: Major
                  Found in salt/modules/debian_ip.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if bond['arp_ip_target']:
                                            bond['arp_ip_target'] = bond['arp_ip_target'] + ',' + ip
                                        else:
                                            bond['arp_ip_target'] = ip
                                else:
                    Severity: Major
                    Found in salt/modules/debian_ip.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if 'data' not in adapters[iface_name]:
                                              adapters[iface_name]['data'] = salt.utils.odict.OrderedDict()
                      
                      
                      Severity: Major
                      Found in salt/modules/debian_ip.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if addrfam not in adapters[iface_name]['data']:
                                                adapters[iface_name]['data'][addrfam] = salt.utils.odict.OrderedDict()
                        
                        
                        Severity: Major
                        Found in salt/modules/debian_ip.py - About 45 mins to fix

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

                          def __within2(value, within=None, errmsg=None, dtype=None):
                              '''validate that a value is in ``within`` and optionally a ``dtype``'''
                              valid, _value = False, value
                              if dtype:
                                  try:
                          Severity: Minor
                          Found in salt/modules/debian_ip.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 iface_name not in adapters:
                                                  adapters[iface_name] = salt.utils.odict.OrderedDict()
                          
                                              # Create item in dict, if not already there
                                              if 'data' not in adapters[iface_name]:
                          Severity: Major
                          Found in salt/modules/debian_ip.py - About 45 mins to fix

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

                            def _parse_current_network_settings():
                                '''
                                Parse /etc/default/networking and return current configuration
                                '''
                                opts = salt.utils.odict.OrderedDict()
                            Severity: Minor
                            Found in salt/modules/debian_ip.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_interface has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def get_interface(iface):
                                '''
                                Return the contents of an interface script
                            
                                CLI Example:
                            Severity: Minor
                            Found in salt/modules/debian_ip.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

                            Avoid too many return statements within this function.
                            Open

                                    return _parse_settings_bond_6(opts, iface, bond_def)
                            Severity: Major
                            Found in salt/modules/debian_ip.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return _parse_settings_bond_4(opts, iface, bond_def)
                              Severity: Major
                              Found in salt/modules/debian_ip.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return _parse_settings_bond_5(opts, iface, bond_def)
                                Severity: Major
                                Found in salt/modules/debian_ip.py - About 30 mins to fix

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

                                  def _parse_settings_bond_4(opts, iface, bond_def):
                                      '''
                                      Filters given options and outputs valid settings for bond4.
                                      If an option has a value that is not expected, this
                                      function will log what the Interface, Setting and what it was
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 days to fix
                                  salt/modules/rh_ip.py on lines 442..490

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

                                  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 _parse_settings_bond_2(opts, iface, bond_def):
                                      '''
                                      Filters given options and outputs valid settings for bond2.
                                      If an option has a value that is not expected, this
                                      function will log what the Interface, Setting and what it was
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 days to fix
                                  salt/modules/rh_ip.py on lines 359..403

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

                                  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 _parse_settings_bond(opts, iface):
                                      '''
                                      Filters given options and outputs valid settings for requested
                                      operation. If an option has a value that is not expected, this
                                      function will log what the Interface, Setting and what it was
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 days to fix
                                  salt/modules/rh_ip.py on lines 188..273

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

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

                                  def _parse_settings_bond_5(opts, iface, bond_def):
                                  
                                      '''
                                      Filters given options and outputs valid settings for bond5.
                                      If an option has a value that is not expected, this
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 4 other locations - About 2 days to fix
                                  salt/modules/debian_ip.py on lines 1091..1127
                                  salt/modules/rh_ip.py on lines 320..356
                                  salt/modules/rh_ip.py on lines 493..529
                                  salt/modules/rh_ip.py on lines 532..568

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

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

                                  def _parse_settings_bond_6(opts, iface, bond_def):
                                  
                                      '''
                                      Filters given options and outputs valid settings for bond6.
                                      If an option has a value that is not expected, this
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 4 other locations - About 2 days to fix
                                  salt/modules/debian_ip.py on lines 1052..1088
                                  salt/modules/rh_ip.py on lines 320..356
                                  salt/modules/rh_ip.py on lines 493..529
                                  salt/modules/rh_ip.py on lines 532..568

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

                                  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 _parse_settings_bond_3(opts, iface, bond_def):
                                  
                                      '''
                                      Filters given options and outputs valid settings for bond3.
                                      If an option has a value that is not expected, this
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 days to fix
                                  salt/modules/rh_ip.py on lines 406..439

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

                                  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 option in ('rx', 'tx', 'sg', 'tso', 'ufo', 'gso', 'gro', 'lro'):
                                          if option in opts:
                                              if opts[option] in _CONFIG_TRUE:
                                                  config.update({option: 'on'})
                                              elif opts[option] in _CONFIG_FALSE:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 5 hrs to fix
                                  salt/modules/rh_ip.py on lines 176..183

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

                                  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

                                  def _parse_routes(iface, opts):
                                      '''
                                      Filters given options and outputs valid settings for
                                      the route settings file.
                                      '''
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 5 hrs to fix
                                  salt/modules/rh_ip.py on lines 819..833

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

                                  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

                                      if 'speed' in opts:
                                          valid = ['10', '100', '1000', '10000']
                                          if six.text_type(opts['speed']) in valid:
                                              config.update({'speed': opts['speed']})
                                          else:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 4 hrs to fix
                                  salt/modules/rh_ip.py on lines 156..161

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

                                  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 'autoneg' in opts:
                                          if opts['autoneg'] in _CONFIG_TRUE:
                                              config.update({'autoneg': 'on'})
                                          elif opts['autoneg'] in _CONFIG_FALSE:
                                              config.update({'autoneg': 'off'})
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 2 other locations - About 4 hrs to fix
                                  salt/modules/debian_ip.py on lines 1175..1181
                                  salt/modules/rh_ip.py on lines 141..147

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

                                  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 'stp' in opts:
                                          if opts['stp'] in _CONFIG_TRUE:
                                              config.update({'stp': 'on'})
                                          elif opts['stp'] in _CONFIG_FALSE:
                                              config.update({'stp': 'off'})
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 2 other locations - About 4 hrs to fix
                                  salt/modules/debian_ip.py on lines 704..710
                                  salt/modules/rh_ip.py on lines 141..147

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

                                  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 settings['require_reboot'] in _CONFIG_TRUE:
                                          log.warning(
                                              'The network state sls is requiring a reboot of the system to '
                                              'properly apply network configuration.'
                                          )
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 hrs to fix
                                  salt/modules/nilrt_ip.py on lines 1031..1040

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

                                  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

                                      if not os.path.exists(os.path.dirname(filename)):
                                          msg = '{0} cannot be written.'
                                          msg = msg.format(os.path.dirname(filename))
                                          log.error(msg)
                                          raise AttributeError(msg)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 hrs to fix
                                  salt/modules/debian_ip.py on lines 1553..1557

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

                                  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

                                      if not os.path.exists(os.path.dirname(filename)):
                                          msg = '{0} cannot be written.'
                                          msg = msg.format(os.path.dirname(filename))
                                          log.error(msg)
                                          raise AttributeError(msg)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 hrs to fix
                                  salt/modules/debian_ip.py on lines 1520..1524

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

                                  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

                                      if 'duplex' in opts:
                                          valid = ['full', 'half']
                                          if opts['duplex'] in valid:
                                              config.update({'duplex': opts['duplex']})
                                          else:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 3 hrs to fix
                                  salt/modules/rh_ip.py on lines 149..154

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

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

                                      if settings['apply_hostname'] in _CONFIG_TRUE:
                                          if 'hostname' in settings:
                                              hostname_res = __salt__['network.mod_hostname'](settings['hostname'])
                                          else:
                                              log.warning(
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 2 other locations - About 3 hrs to fix
                                  salt/modules/nilrt_ip.py on lines 1020..1028
                                  salt/modules/rh_ip.py on lines 1240..1248

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

                                  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 attr.startswith('bond'):
                                                          opt = re.split(r'[_-]', attr, maxsplit=1)[1]
                                                          if 'bonding' not in iface_dict:
                                                              iface_dict['bonding'] = salt.utils.odict.OrderedDict()
                                                          iface_dict['bonding'][opt] = valuestr
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 639..643

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

                                  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 attr.startswith('bridge'):
                                                          opt = re.split(r'[_-]', attr, maxsplit=1)[1]
                                                          if 'bridging' not in iface_dict:
                                                              iface_dict['bridging'] = salt.utils.odict.OrderedDict()
                                                          iface_dict['bridging'][opt] = valuestr
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 633..637

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

                                  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 line.startswith('allow-hotplug'):
                                                      for word in line.split()[1:]:
                                                          if word not in adapters:
                                                              adapters[word] = salt.utils.odict.OrderedDict()
                                                          adapters[word]['hotplug'] = True
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 653..657

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

                                  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 line.startswith('auto'):
                                                      for word in line.split()[1:]:
                                                          if word not in adapters:
                                                              adapters[word] = salt.utils.odict.OrderedDict()
                                                          adapters[word]['enabled'] = True
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 659..663

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

                                  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 down(iface, iface_type):
                                      '''
                                      Shutdown a network interface
                                  
                                      CLI Example:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 1779..1794

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

                                  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 up(iface, iface_type):  # pylint: disable=C0103
                                      '''
                                      Start up a network interface
                                  
                                      CLI Example:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 1717..1732

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

                                  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

                                      skip_etc_default_networking = (
                                          __grains__['osfullname'] == 'Ubuntu' and
                                          int(__grains__['osrelease'].split('.')[0]) >= 12)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 1925..1927

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

                                  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

                                      skip_etc_default_networking = (
                                          __grains__['osfullname'] == 'Ubuntu' and
                                          int(__grains__['osrelease'].split('.')[0]) >= 12)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/debian_ip.py on lines 1807..1809

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

                                  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 'hostname' not in opts:
                                          try:
                                              opts['hostname'] = current['hostname']
                                              _log_default_network('hostname', current['hostname'])
                                          except ValueError:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 2 hrs to fix
                                  salt/modules/rh_ip.py on lines 876..881

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

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

                                      if not os.path.exists(folder):
                                          msg = '{0} cannot be written. {1} does not exist'
                                          msg = msg.format(filename, folder)
                                          log.error(msg)
                                          raise AttributeError(msg)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 2 other locations - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 1400..1404
                                  salt/modules/rh_ip.py on lines 954..958

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

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

                                      if not os.path.exists(folder):
                                          msg = '{0} cannot be written. {1} does not exist'
                                          msg = msg.format(filename, folder)
                                          log.error(msg)
                                          raise AttributeError(msg)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 2 other locations - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 1425..1429
                                  salt/modules/rh_ip.py on lines 954..958

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

                                  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

                                  _REV_ETHTOOL_CONFIG_OPTS = {
                                      'link-speed': 'speed',
                                      'link-duplex': 'duplex',
                                      'ethernet-autoneg': 'autoneg',
                                      'ethernet-port': 'ethernet-port',
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 58..83

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

                                  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

                                  _ETHTOOL_CONFIG_OPTS = {
                                      'speed': 'link-speed',
                                      'duplex': 'link-duplex',
                                      'autoneg': 'ethernet-autoneg',
                                      'ethernet-port': 'ethernet-port',
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 86..111

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

                                  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

                                  def _error_msg_iface(iface, option, expected):
                                      '''
                                      Build an appropriate error message from a given option and
                                      a list of expected values.
                                      '''
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/rh_ip.py on lines 78..84

                                  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

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

                                      if iface_type == 'slave':
                                          settings['slave'] = 'yes'
                                          if 'master' not in settings:
                                              msg = 'master is a required setting for slave interfaces'
                                              log.error(msg)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/rh_ip.py on lines 1043..1048

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

                                  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

                                  def _error_msg_network(option, expected):
                                      '''
                                      Build an appropriate error message from a given option and
                                      a list of expected values.
                                      '''
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/rh_ip.py on lines 101..107

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

                                  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 __float(value):
                                      '''validate a float'''
                                      valid, _value = False, value
                                      try:
                                          _value = float(value)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 315..323

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

                                  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 __int(value):
                                      '''validate an integer'''
                                      valid, _value = False, value
                                      try:
                                          _value = int(value)
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 326..334

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

                                  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 new_domainname != current_domainname:
                                              domainname = new_domainname
                                              opts['domainname'] = new_domainname
                                              new_domain = True
                                          else:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 1975..1981

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

                                  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 new_searchdomain != current_searchdomain:
                                              searchdomain = new_searchdomain
                                              opts['searchdomain'] = new_searchdomain
                                              new_search = True
                                          else:
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/modules/debian_ip.py on lines 1961..1967

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

                                  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 opt in opts:
                                              iface_data['inet'][opt] = opts[opt]
                                              iface_data['inet6'][opt] = opts[opt]
                                  Severity: Major
                                  Found in salt/modules/debian_ip.py and 1 other location - About 1 hr to fix
                                  salt/states/boto_dynamodb.py on lines 570..572

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

                                  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