saltstack/salt

View on GitHub
salt/modules/rh_ip.py

Summary

Maintainability
F
1 mo
Test Coverage

Function _parse_settings_eth has a Cognitive Complexity of 130 (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/rh_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

File rh_ip.py has 1013 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
Severity: Major
Found in salt/modules/rh_ip.py - About 2 days to fix

    Cyclomatic complexity is too high in function _parse_settings_eth. (72)
    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/rh_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/rh_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/rh_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_network_settings has a Cognitive Complexity of 26 (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/rh_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 25 (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/rh_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_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/rh_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 build_interface has a Cognitive Complexity of 15 (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/rh_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_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/rh_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_1 has a Cognitive Complexity of 14 (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/rh_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/rh_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/rh_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_vlan has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_settings_vlan(opts, iface):
    
        '''
        Filters given options and outputs valid settings for a vlan
        '''
    Severity: Minor
    Found in salt/modules/rh_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_eth has 28 lines of code (exceeds 25 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/rh_ip.py - About 1 hr to fix

      Function _parse_rh_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _parse_rh_config(path):
          rh_config = _read_file(path)
          cv_rh_config = {}
          if rh_config:
              for line in rh_config:
      Severity: Minor
      Found in salt/modules/rh_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/rh_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 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/rh_ip.py - About 45 mins to fix

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

        def build_routes(iface, **settings):
            '''
            Build a route script for a network interface.
        
            CLI Example:
        Severity: Minor
        Found in salt/modules/rh_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

        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/rh_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 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/rh_ip.py - About 45 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/rh_ip.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return _parse_settings_bond_6(opts, iface, bond_def)
            Severity: Major
            Found in salt/modules/rh_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/rh_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/rh_ip.py and 1 other location - About 3 days to fix
                salt/modules/debian_ip.py on lines 1001..1049

                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/rh_ip.py and 1 other location - About 3 days to fix
                salt/modules/debian_ip.py on lines 918..962

                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/rh_ip.py and 1 other location - About 3 days to fix
                salt/modules/debian_ip.py on lines 768..835

                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_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/rh_ip.py and 4 other locations - About 2 days to fix
                salt/modules/debian_ip.py on lines 1052..1088
                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

                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_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: Major
                Found in salt/modules/rh_ip.py and 4 other locations - About 2 days to fix
                salt/modules/debian_ip.py on lines 1052..1088
                salt/modules/debian_ip.py on lines 1091..1127
                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_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/rh_ip.py and 4 other locations - About 2 days to fix
                salt/modules/debian_ip.py on lines 1052..1088
                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 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/rh_ip.py and 1 other location - About 2 days to fix
                salt/modules/debian_ip.py on lines 965..998

                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/rh_ip.py and 1 other location - About 5 hrs to fix
                salt/modules/debian_ip.py on lines 727..734

                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/rh_ip.py and 1 other location - About 5 hrs to fix
                salt/modules/debian_ip.py on lines 1378..1392

                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

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

                    if 'nm_controlled' in opts:
                        if opts['nm_controlled'] in _CONFIG_TRUE:
                            result['nm_controlled'] = 'yes'
                        elif opts['nm_controlled'] in _CONFIG_FALSE:
                            result['nm_controlled'] = 'no'
                Severity: Major
                Found in salt/modules/rh_ip.py and 1 other location - About 4 hrs to fix
                salt/modules/rh_ip.py on lines 771..779

                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

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

                    if 'userctl' in opts:
                        if opts['userctl'] in _CONFIG_TRUE:
                            result['userctl'] = 'yes'
                        elif opts['userctl'] in _CONFIG_FALSE:
                            result['userctl'] = 'no'
                Severity: Major
                Found in salt/modules/rh_ip.py and 1 other location - About 4 hrs to fix
                salt/modules/rh_ip.py on lines 806..814

                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/rh_ip.py and 1 other location - About 4 hrs to fix
                salt/modules/debian_ip.py on lines 719..724

                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/rh_ip.py and 2 other locations - About 4 hrs to fix
                salt/modules/debian_ip.py on lines 704..710
                salt/modules/debian_ip.py on lines 1175..1181

                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

                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/rh_ip.py and 1 other location - About 3 hrs to fix
                salt/modules/debian_ip.py on lines 712..717

                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/rh_ip.py and 2 other locations - About 3 hrs to fix
                salt/modules/debian_ip.py on lines 1879..1887
                salt/modules/nilrt_ip.py on lines 1020..1028

                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

                    if networking in valid:
                        if networking in _CONFIG_TRUE:
                            result['networking'] = true_val
                        elif networking in _CONFIG_FALSE:
                            result['networking'] = false_val
                Severity: Major
                Found in salt/modules/rh_ip.py and 1 other location - About 2 hrs to fix
                salt/modules/rh_ip.py on lines 891..897

                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

                        if nozeroconf in valid:
                            if nozeroconf in _CONFIG_TRUE:
                                result['nozeroconf'] = true_val
                            elif nozeroconf in _CONFIG_FALSE:
                                result['nozeroconf'] = false_val
                Severity: Major
                Found in salt/modules/rh_ip.py and 1 other location - About 2 hrs to fix
                salt/modules/rh_ip.py on lines 868..874

                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

                    if 'hostname' not in opts:
                        try:
                            opts['hostname'] = current['hostname']
                            _log_default_network('hostname', current['hostname'])
                        except Exception:
                Severity: Major
                Found in salt/modules/rh_ip.py and 1 other location - About 2 hrs to fix
                salt/modules/debian_ip.py on lines 1360..1365

                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/rh_ip.py and 2 other locations - About 1 hr to fix
                salt/modules/debian_ip.py on lines 1400..1404
                salt/modules/debian_ip.py on lines 1425..1429

                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 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/rh_ip.py and 1 other location - About 1 hr to fix
                salt/modules/debian_ip.py on lines 155..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 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/rh_ip.py and 1 other location - About 1 hr to fix
                salt/modules/debian_ip.py on lines 1623..1628

                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/rh_ip.py and 1 other location - About 1 hr to fix
                salt/modules/debian_ip.py on lines 180..186

                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 up(iface, iface_type):  # pylint: disable=C0103
                    '''
                    Start up a network interface
                
                    CLI Example:
                Severity: Minor
                Found in salt/modules/rh_ip.py and 1 other location - About 50 mins to fix
                salt/modules/rh_ip.py on lines 1133..1146

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 44.

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

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

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

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

                Refactorings

                Further Reading

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

                def down(iface, iface_type):
                    '''
                    Shutdown a network interface
                
                    CLI Example:
                Severity: Minor
                Found in salt/modules/rh_ip.py and 1 other location - About 50 mins to fix
                salt/modules/rh_ip.py on lines 1177..1190

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 44.

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

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

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

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

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status