saltstack/salt

View on GitHub
salt/states/panos.py

Summary

Maintainability
F
2 wks
Test Coverage

File panos.py has 1176 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
A state module to manage Palo Alto network devices.

:codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>``
Severity: Major
Found in salt/states/panos.py - About 3 days to fix

    Function security_rule_exists has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

    def security_rule_exists(name,
                             rulename=None,
                             vsys='1',
                             action=None,
                             disabled=None,
    Severity: Minor
    Found in salt/states/panos.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in function security_rule_exists. (44)
    Open

    def security_rule_exists(name,
                             rulename=None,
                             vsys='1',
                             action=None,
                             disabled=None,
    Severity: Minor
    Found in salt/states/panos.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 _validate_response has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _validate_response(response):
        '''
        Validates a response from a Palo Alto device. Used to verify success of commands.
    
        '''
    Severity: Minor
    Found in salt/states/panos.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 address_exists has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def address_exists(name,
                       addressname=None,
                       vsys=1,
                       ipnetmask=None,
                       iprange=None,
    Severity: Minor
    Found in salt/states/panos.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 download_software has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def download_software(name, version=None, synch=False, check=False):
        '''
        Ensures that a software version is downloaded.
    
        name: The name of the module function to execute.
    Severity: Minor
    Found in salt/states/panos.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 address_group_exists has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def address_group_exists(name,
                             groupname=None,
                             vsys=1,
                             members=None,
                             description=None,
    Severity: Minor
    Found in salt/states/panos.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 service_group_exists has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def service_group_exists(name,
                             groupname=None,
                             vsys=1,
                             members=None,
                             description=None,
    Severity: Minor
    Found in salt/states/panos.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 service_exists has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def service_exists(name, servicename=None, vsys=1, protocol=None, port=None, description=None, commit=False):
        '''
        Ensures that a service object exists in the configured state. If it does not exist or is not configured with the
        specified attributes, it will be adjusted to match the specified values.
    
    
    Severity: Minor
    Found in salt/states/panos.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 security_rule_exists has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def security_rule_exists(name,
                             rulename=None,
                             vsys='1',
                             action=None,
                             disabled=None,
    Severity: Minor
    Found in salt/states/panos.py - About 1 hr to fix

      Function edit_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def edit_config(name, xpath=None, value=None, commit=False):
          '''
          Edits a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not
          changed.
      
      
      Severity: Minor
      Found in salt/states/panos.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

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

      def move_config(name, xpath=None, where=None, dst=None, commit=False):
          '''
          Moves a XPATH value to a new location.
      
          Use the xpath parameter to specify the location of the object to be moved, the where parameter to
      Severity: Minor
      Found in salt/states/panos.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      def _build_members(members, anycheck=False):
          '''
          Builds a member formatted string for XML operation.
      
          '''
      Severity: Minor
      Found in salt/states/panos.py - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid too many return statements within this function.
      Open

                  return True, response
      Severity: Major
      Found in salt/states/panos.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

                                  return False, response
                      Severity: Major
                      Found in salt/states/panos.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

                                      return True, response
                          Severity: Major
                          Found in salt/states/panos.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return False, response
                            Severity: Major
                            Found in salt/states/panos.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

                                              return False, response
                                  Severity: Major
                                  Found in salt/states/panos.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

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

                                          def service_group_exists(name,
                                                                   groupname=None,
                                                                   vsys=1,
                                                                   members=None,
                                                                   description=None,
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 3 days to fix
                                          salt/states/panos.py on lines 427..530

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 339.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def address_group_exists(name,
                                                                   groupname=None,
                                                                   vsys=1,
                                                                   members=None,
                                                                   description=None,
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 3 days to fix
                                          salt/states/panos.py on lines 1441..1544

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 339.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def rename_config(name, xpath=None, newname=None, commit=False):
                                              '''
                                              Rename a Palo Alto XPATH to a specific value. This will always rename the value even if a change is not needed.
                                          
                                              name: The name of the module function to execute.
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 day to fix
                                          salt/states/panos.py on lines 533..586

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

                                          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 clone_config(name, xpath=None, newname=None, commit=False):
                                              '''
                                              Clone a specific XPATH and set it to a new name.
                                          
                                              name: The name of the module function to execute.
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 day to fix
                                          salt/states/panos.py on lines 915..967

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

                                          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 where == 'after':
                                                  result, msg = _move_after(xpath, dst)
                                              elif where == 'before':
                                                  result, msg = _move_before(xpath, dst)
                                              elif where == 'top':
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 2 hrs to fix
                                          salt/states/panos.py on lines 1294..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 69.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                                  if move == "before" and movetarget:
                                                      move_result, move_msg = _move_before(movepath, movetarget)
                                                  elif move == "after":
                                                      move_result, move_msg = _move_after(movepath, movetarget)
                                                  elif move == "top":
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 2 hrs to fix
                                          salt/states/panos.py on lines 865..872

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 69.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                              if 'sw-updates' not in versions \
                                                  or 'versions' not in versions['sw-updates'] \
                                                  or 'entry' not in versions['sw-updates']['versions']:
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 695..697

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 43.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                              if 'sw-updates' not in versions \
                                                  or 'versions' not in versions['sw-updates'] \
                                                  or 'entry' not in versions['sw-updates']['versions']:
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 718..720

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 43.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def _move_after(xpath, target):
                                              '''
                                              Moves an xpath to the after of its section.
                                          
                                              '''
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 179..192

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 49.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def _move_before(xpath, target):
                                              '''
                                              Moves an xpath to the bottom of its section.
                                          
                                              '''
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 163..176

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 49.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def _edit_config(xpath, element):
                                              '''
                                              Sends an edit request to the device.
                                          
                                              '''
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 225..237

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 47.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def _set_config(xpath, element):
                                              '''
                                              Sends a set request to the device.
                                          
                                              '''
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 134..146

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 47.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def _move_top(xpath):
                                              '''
                                              Moves an xpath to the top of its section.
                                          
                                              '''
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 195..207

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

                                          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 _move_bottom(xpath):
                                              '''
                                              Moves an xpath to the bottom of its section.
                                          
                                              '''
                                          Severity: Major
                                          Found in salt/states/panos.py and 1 other location - About 1 hr to fix
                                          salt/states/panos.py on lines 210..222

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

                                          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

                                          def commit_config(name):
                                              '''
                                              Commits the candidate configuration to the running configuration.
                                          
                                              name: The name of the module function to execute.
                                          Severity: Major
                                          Found in salt/states/panos.py and 2 other locations - About 50 mins to fix
                                          salt/states/panos.py on lines 268..289
                                          salt/states/panos.py on lines 891..912

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 44.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def remove_config_lock(name):
                                              '''
                                              Release config lock previously held.
                                          
                                              name: The name of the module function to execute.
                                          Severity: Major
                                          Found in salt/states/panos.py and 2 other locations - About 50 mins to fix
                                          salt/states/panos.py on lines 268..289
                                          salt/states/panos.py on lines 589..610

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 44.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def add_config_lock(name):
                                              '''
                                              Prevent other users from changing configuration until the lock is released.
                                          
                                              name: The name of the module function to execute.
                                          Severity: Major
                                          Found in salt/states/panos.py and 2 other locations - About 50 mins to fix
                                          salt/states/panos.py on lines 589..610
                                          salt/states/panos.py on lines 891..912

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 44.

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

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

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

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

                                          Refactorings

                                          Further Reading

                                          There are no issues that match your filters.

                                          Category
                                          Status