saltstack/salt

View on GitHub
salt/modules/junos.py

Summary

Maintainability
F
2 wks
Test Coverage

File junos.py has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Module to interact with Junos devices.

:maturity: new
Severity: Major
Found in salt/modules/junos.py - About 3 days to fix

    Function rpc has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def rpc(cmd=None, dest=None, **kwargs):
        '''
        This function executes the RPC provided as arguments on the junos device.
        The returned data can be stored in a file.
    
    
    Severity: Minor
    Found in salt/modules/junos.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

    Function install_config has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def install_config(path=None, **kwargs):
        '''
        Installs the given configuration file into the candidate configuration.
        Commits the changes if the commit checks or throws an error.
    
    
    Severity: Minor
    Found in salt/modules/junos.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 get_table has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_table(table, table_file, path=None, target=None, key=None, key_items=None,
                  filters=None, template_args=None):
        '''
        Retrieve data from a Junos device using Tables/Views
    
    
    Severity: Minor
    Found in salt/modules/junos.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 install_config. (33)
    Open

    @timeoutDecorator
    def install_config(path=None, **kwargs):
        '''
        Installs the given configuration file into the candidate configuration.
        Commits the changes if the commit checks or throws an error.
    Severity: Minor
    Found in salt/modules/junos.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 load has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def load(path=None, **kwargs):
        '''
        Loads the configuration from the file provided onto the device.
    
        path (required)
    Severity: Minor
    Found in salt/modules/junos.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 rollback has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def rollback(**kwargs):
        '''
        Roll back the last committed configuration changes and commit
    
        id : 0
    Severity: Minor
    Found in salt/modules/junos.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 commit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def commit(**kwargs):
        '''
        To commit the changes loaded in the candidate configuration.
    
        dev_timeout : 30
    Severity: Minor
    Found in salt/modules/junos.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 install_os has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def install_os(path=None, **kwargs):
        '''
        Installs the given image on the device. After the installation is complete\
         the device is rebooted,
        if reboot=True is given as a keyworded argument.
    Severity: Minor
    Found in salt/modules/junos.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 shutdown has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def shutdown(**kwargs):
        '''
        Shut down (power off) or reboot a device running Junos OS. This includes
        all Routing Engines in a Virtual Chassis or a dual Routing Engine system.
    
    
    Severity: Minor
    Found in salt/modules/junos.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 get_table. (21)
    Open

    def get_table(table, table_file, path=None, target=None, key=None, key_items=None,
                  filters=None, template_args=None):
        '''
        Retrieve data from a Junos device using Tables/Views
    
    
    Severity: Minor
    Found in salt/modules/junos.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 set_hostname has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_hostname(hostname=None, **kwargs):
        '''
        Set the device's hostname
    
        hostname
    Severity: Minor
    Found in salt/modules/junos.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 cli has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def cli(command=None, **kwargs):
        '''
        Executes the CLI commands and returns the output in specified format. \
        (default is text) The output can also be stored in a file.
    
    
    Severity: Minor
    Found in salt/modules/junos.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 ping has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def ping(dest_ip=None, **kwargs):
        '''
        Send a ping RPC to a device
    
        dest_ip
    Severity: Minor
    Found in salt/modules/junos.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 timeoutDecorator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def timeoutDecorator(function):
        @wraps(function)
        def wrapper(*args, **kwargs):
            if 'dev_timeout' in kwargs:
                conn = __proxy__['junos.conn']()
    Severity: Minor
    Found in salt/modules/junos.py - About 55 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 ret
    Severity: Major
    Found in salt/modules/junos.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return ret
      Severity: Major
      Found in salt/modules/junos.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return ret
        Severity: Major
        Found in salt/modules/junos.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return ret
          Severity: Major
          Found in salt/modules/junos.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return ret
            Severity: Major
            Found in salt/modules/junos.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return ret
              Severity: Major
              Found in salt/modules/junos.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return ret
                Severity: Major
                Found in salt/modules/junos.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return ret
                  Severity: Major
                  Found in salt/modules/junos.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return ret
                    Severity: Major
                    Found in salt/modules/junos.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return ret
                      Severity: Major
                      Found in salt/modules/junos.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return ret
                        Severity: Major
                        Found in salt/modules/junos.py - About 30 mins to fix

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

                              if 'replace' in op and op['replace']:
                                  op['merge'] = False
                                  del op['replace']
                              elif 'overwrite' in op and op['overwrite']:
                                  op['overwrite'] = True
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 7 hrs to fix
                          salt/modules/junos.py on lines 901..908

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

                          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 'replace' in op and op['replace']:
                                  op['merge'] = False
                                  del op['replace']
                              elif 'overwrite' in op and op['overwrite']:
                                  op['overwrite'] = True
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 7 hrs to fix
                          salt/modules/junos.py on lines 1320..1327

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

                          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 unlock():
                              '''
                              Unlocks the candidate configuration.
                          
                              CLI Example:
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 5 hrs to fix
                          salt/modules/junos.py on lines 1163..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 102.

                          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 lock():
                              '''
                              Attempts an exclusive lock on the candidate configuration. This
                              is a non-blocking call.
                          
                          
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 5 hrs to fix
                          salt/modules/junos.py on lines 1193..1214

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 856..861
                          salt/modules/junos.py on lines 1281..1286

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

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

                              if '__pub_arg' in kwargs:
                                  if kwargs['__pub_arg']:
                                      if isinstance(kwargs['__pub_arg'][-1], dict):
                                          op.update(kwargs['__pub_arg'][-1])
                              else:
                          Severity: Major
                          Found in salt/modules/junos.py and 8 other locations - About 3 hrs to fix
                          salt/modules/junos.py on lines 311..316
                          salt/modules/junos.py on lines 401..406
                          salt/modules/junos.py on lines 480..485
                          salt/modules/junos.py on lines 608..613
                          salt/modules/junos.py on lines 668..673
                          salt/modules/junos.py on lines 734..739
                          salt/modules/junos.py on lines 1060..1065
                          salt/modules/junos.py on lines 1281..1286

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

                          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 'format' not in op:
                                  if path.endswith('set'):
                                      template_format = 'set'
                                  elif path.endswith('xml'):
                                      template_format = 'xml'
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 2 hrs to fix
                          salt/modules/junos.py on lines 1310..1318

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

                              if 'format' not in op:
                                  if path.endswith('set'):
                                      template_format = 'set'
                                  elif path.endswith('xml'):
                                      template_format = 'xml'
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 2 hrs to fix
                          salt/modules/junos.py on lines 891..899

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

                                  try:
                                      cu.load(**op)
                          
                                  except Exception as exception:
                                      ret['message'] = 'Could not load configuration due to : "{0}"'.format(
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 2 hrs to fix
                          salt/modules/junos.py on lines 1329..1337

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

                          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

                              try:
                                  conn.cu.load(**op)
                                  ret['message'] = "Successfully loaded the configuration."
                              except Exception as exception:
                                  ret['message'] = 'Could not load configuration due to : "{0}"'.format(
                          Severity: Major
                          Found in salt/modules/junos.py and 1 other location - About 2 hrs to fix
                          salt/modules/junos.py on lines 912..920

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

                          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

                              try:
                                  commit_ok = conn.cu.commit_check()
                              except Exception as exception:
                                  ret['message'] = 'Could not perform commit check due to "{0}"'.format(
                                      exception)
                          Severity: Major
                          Found in salt/modules/junos.py and 2 other locations - About 1 hr to fix
                          salt/modules/junos.py on lines 329..335
                          salt/modules/junos.py on lines 510..516

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

                          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

                              try:
                                  commit_ok = conn.cu.commit_check()
                              except Exception as exception:
                                  ret['message'] = 'Could not commit check due to error "{0}"'.format(
                                      exception)
                          Severity: Major
                          Found in salt/modules/junos.py and 2 other locations - About 1 hr to fix
                          salt/modules/junos.py on lines 410..416
                          salt/modules/junos.py on lines 510..516

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

                          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

                              try:
                                  commit_ok = conn.cu.commit_check()
                              except Exception as exception:
                                  ret['message'] = 'Could not commit check due to "{0}"'.format(
                                      exception)
                          Severity: Major
                          Found in salt/modules/junos.py and 2 other locations - About 1 hr to fix
                          salt/modules/junos.py on lines 329..335
                          salt/modules/junos.py on lines 410..416

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

                          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 os.path.getsize(template_cached_path) == 0:
                                  ret['message'] = 'Template failed to render'
                                  ret['out'] = False
                                  return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 2 other locations - About 45 mins to fix
                          salt/modules/junos.py on lines 1084..1087
                          salt/modules/junos.py on lines 1303..1306

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

                                  if os.path.getsize(image_cached_path) == 0:
                                      ret['message'] = 'Failed to copy image'
                                      ret['out'] = False
                                      return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 2 other locations - About 45 mins to fix
                          salt/modules/junos.py on lines 879..882
                          salt/modules/junos.py on lines 1303..1306

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

                              if os.path.getsize(template_cached_path) == 0:
                                  ret['message'] = 'Template failed to render'
                                  ret['out'] = False
                                  return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 2 other locations - About 45 mins to fix
                          salt/modules/junos.py on lines 879..882
                          salt/modules/junos.py on lines 1084..1087

                          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

                                  try:
                                      with salt.utils.files.fopen(file_name) as fp:
                                          ret['table'] = yaml.load(fp.read(),
                                                                   Loader=yamlordereddictloader.Loader)
                                          globals().update(FactoryLoader().load(ret['table']))
                          Severity: Minor
                          Found in salt/modules/junos.py and 1 other location - About 45 mins to fix
                          salt/modules/junos.py on lines 1444..1448

                          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

                                  except KeyError as err:
                                      ret['message'] = 'Uncaught exception during get API call - please ' \
                                                       'report: {0}'.format(six.text_type(err))
                                      ret['out'] = False
                                      return ret
                          Severity: Minor
                          Found in salt/modules/junos.py and 1 other location - About 45 mins to fix
                          salt/modules/junos.py on lines 1431..1440

                          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

                                  if diff is not None:
                                      with salt.utils.files.fopen(op['diffs_file'], 'w') as fp:
                                          fp.write(salt.utils.stringutils.to_str(diff))
                          Severity: Minor
                          Found in salt/modules/junos.py and 1 other location - About 40 mins to fix
                          salt/modules/junos.py on lines 688..690

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

                          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 'dest' in op and op['dest'] is not None:
                                  with salt.utils.files.fopen(op['dest'], 'w') as fp:
                                      fp.write(salt.utils.stringutils.to_str(result))
                          Severity: Minor
                          Found in salt/modules/junos.py and 1 other location - About 40 mins to fix
                          salt/modules/junos.py on lines 502..504

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

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

                              if not os.path.isfile(template_cached_path):
                                  ret['message'] = 'Invalid file path.'
                                  ret['out'] = False
                                  return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 3 other locations - About 35 mins to fix
                          salt/modules/junos.py on lines 1079..1082
                          salt/modules/junos.py on lines 1140..1143
                          salt/modules/junos.py on lines 1298..1301

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

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

                              if not os.path.isfile(src):
                                  ret['message'] = 'Invalid source file path'
                                  ret['out'] = False
                                  return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 3 other locations - About 35 mins to fix
                          salt/modules/junos.py on lines 874..877
                          salt/modules/junos.py on lines 1079..1082
                          salt/modules/junos.py on lines 1298..1301

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

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

                                  if not os.path.isfile(image_cached_path):
                                      ret['message'] = 'Invalid image path.'
                                      ret['out'] = False
                                      return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 3 other locations - About 35 mins to fix
                          salt/modules/junos.py on lines 874..877
                          salt/modules/junos.py on lines 1140..1143
                          salt/modules/junos.py on lines 1298..1301

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

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

                              if not os.path.isfile(template_cached_path):
                                  ret['message'] = 'Invalid file path.'
                                  ret['out'] = False
                                  return ret
                          Severity: Major
                          Found in salt/modules/junos.py and 3 other locations - About 35 mins to fix
                          salt/modules/junos.py on lines 874..877
                          salt/modules/junos.py on lines 1079..1082
                          salt/modules/junos.py on lines 1140..1143

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

                          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

                              elif '__pub_schedule' in kwargs:
                                  for key, value in six.iteritems(kwargs):
                                      if not key.startswith('__pub_'):
                                          op[key] = value
                          Severity: Minor
                          Found in salt/modules/junos.py and 2 other locations - About 30 mins to fix
                          salt/modules/napalm_mod.py on lines 272..275
                          salt/utils/args.py on lines 49..51

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

                          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