saltstack/salt

View on GitHub
salt/states/firewalld.py

Summary

Maintainability
F
3 wks
Test Coverage

Function _present has a Cognitive Complexity of 264 (exceeds 5 allowed). Consider refactoring.
Open

def _present(name,
            block_icmp=None,
            prune_block_icmp=False,
            default=None,
            masquerade=False,
Severity: Minor
Found in salt/states/firewalld.py - About 5 days to fix

Cognitive Complexity

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

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

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

Further reading

Cyclomatic complexity is too high in function _present. (126)
Open

def _present(name,
            block_icmp=None,
            prune_block_icmp=False,
            default=None,
            masquerade=False,
Severity: Minor
Found in salt/states/firewalld.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

File firewalld.py has 610 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Management of firewalld

.. versionadded:: 2015.8.0
Severity: Major
Found in salt/states/firewalld.py - About 1 day to fix

    Function service has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    def service(name,
                ports=None,
                protocols=None):
        '''
        Ensure the service exists and encompasses the specified ports and
    Severity: Minor
    Found in salt/states/firewalld.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

    Cyclomatic complexity is too high in function service. (25)
    Open

    def service(name,
                ports=None,
                protocols=None):
        '''
        Ensure the service exists and encompasses the specified ports and
    Severity: Minor
    Found in salt/states/firewalld.py by radon

    Cyclomatic Complexity

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

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

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

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

    Avoid too many return statements within this function.
    Open

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

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

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

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

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

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

                                          Avoid too many return statements within this function.
                                          Open

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

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

                                                Avoid too many return statements within this function.
                                                Open

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

                                                  Avoid too many return statements within this function.
                                                  Open

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

                                                    Avoid too many return statements within this function.
                                                    Open

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

                                                      Avoid too many return statements within this function.
                                                      Open

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

                                                        Avoid too many return statements within this function.
                                                        Open

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

                                                          Avoid too many return statements within this function.
                                                          Open

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

                                                            Avoid too many return statements within this function.
                                                            Open

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

                                                              Avoid too many return statements within this function.
                                                              Open

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

                                                                Avoid too many return statements within this function.
                                                                Open

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

                                                                  Avoid too many return statements within this function.
                                                                  Open

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

                                                                    Avoid too many return statements within this function.
                                                                    Open

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

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

                                                                          if sources or prune_sources:
                                                                              sources = sources or []
                                                                              try:
                                                                                  _current_sources = __salt__['firewalld.get_sources'](name,
                                                                                                                                       permanent=True)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 days to fix
                                                                      salt/states/firewalld.py on lines 582..621
                                                                      salt/states/firewalld.py on lines 623..662
                                                                      salt/states/firewalld.py on lines 704..743

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

                                                                      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 interfaces or prune_interfaces:
                                                                              interfaces = interfaces or []
                                                                              try:
                                                                                  _current_interfaces = __salt__['firewalld.get_interfaces'](name,
                                                                                      permanent=True)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 days to fix
                                                                      salt/states/firewalld.py on lines 582..621
                                                                      salt/states/firewalld.py on lines 664..702
                                                                      salt/states/firewalld.py on lines 704..743

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

                                                                      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 services or prune_services:
                                                                              services = services or []
                                                                              try:
                                                                                  _current_services = __salt__['firewalld.list_services'](name,
                                                                                      permanent=True)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 days to fix
                                                                      salt/states/firewalld.py on lines 623..662
                                                                      salt/states/firewalld.py on lines 664..702
                                                                      salt/states/firewalld.py on lines 704..743

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

                                                                      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 rich_rules or prune_rich_rules:
                                                                              rich_rules = rich_rules or []
                                                                              try:
                                                                                  _current_rich_rules = __salt__['firewalld.get_rich_rules'](name,
                                                                                      permanent=True)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 days to fix
                                                                      salt/states/firewalld.py on lines 582..621
                                                                      salt/states/firewalld.py on lines 623..662
                                                                      salt/states/firewalld.py on lines 664..702

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

                                                                      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 masquerade and not masquerade_ret:
                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.add_masquerade'](name, permanent=True)
                                                                                  except CommandExecutionError as err:
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 1 other location - About 4 hrs to fix
                                                                      salt/states/firewalld.py on lines 477..487

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

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                          elif not masquerade and masquerade_ret:
                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.remove_masquerade'](name,
                                                                                                                              permanent=True)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 1 other location - About 4 hrs to fix
                                                                      salt/states/firewalld.py on lines 467..476

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

                                                                      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

                                                                          for protocol in new_protocols:
                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.add_service_protocol'](name, protocol)
                                                                                  except CommandExecutionError as err:
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 hrs to fix
                                                                      salt/states/firewalld.py on lines 267..273
                                                                      salt/states/firewalld.py on lines 275..281
                                                                      salt/states/firewalld.py on lines 307..313

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 63.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                          for port in new_ports:
                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.add_service_port'](name, port)
                                                                                  except CommandExecutionError as err:
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 hrs to fix
                                                                      salt/states/firewalld.py on lines 275..281
                                                                      salt/states/firewalld.py on lines 299..305
                                                                      salt/states/firewalld.py on lines 307..313

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 63.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                          for protocol in old_protocols:
                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.remove_service_protocol'](name, protocol)
                                                                                  except CommandExecutionError as err:
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 hrs to fix
                                                                      salt/states/firewalld.py on lines 267..273
                                                                      salt/states/firewalld.py on lines 275..281
                                                                      salt/states/firewalld.py on lines 299..305

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 63.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                          for port in old_ports:
                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.remove_service_port'](name, port)
                                                                                  except CommandExecutionError as err:
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 3 other locations - About 2 hrs to fix
                                                                      salt/states/firewalld.py on lines 267..273
                                                                      salt/states/firewalld.py on lines 299..305
                                                                      salt/states/firewalld.py on lines 307..313

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 63.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                              if not __opts__['test']:
                                                                                  try:
                                                                                      __salt__['firewalld.new_zone'](name)
                                                                                  except CommandExecutionError as err:
                                                                                      ret['comment'] = 'Error: {0}'.format(err)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 1 other location - About 1 hr to fix
                                                                      salt/states/firewalld.py on lines 450..455

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 56.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                                  if not __opts__['test']:
                                                                                      try:
                                                                                          __salt__['firewalld.set_default_zone'](name)
                                                                                      except CommandExecutionError as err:
                                                                                          ret['comment'] = 'Error: {0}'.format(err)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 1 other location - About 1 hr to fix
                                                                      salt/states/firewalld.py on lines 372..377

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 56.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                          try:
                                                                              zones = __salt__['firewalld.get_zones'](permanent=True)
                                                                          except CommandExecutionError as err:
                                                                              ret['comment'] = 'Error: {0}'.format(err)
                                                                              return ret
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 1 other location - About 1 hr to fix
                                                                      salt/states/firewalld.py on lines 396..401

                                                                      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

                                                                                  try:
                                                                                      _valid_icmp_types = __salt__['firewalld.get_icmp_types'](
                                                                                          permanent=True)
                                                                                  except CommandExecutionError as err:
                                                                                      ret['comment'] = 'Error: {0}'.format(err)
                                                                      Severity: Major
                                                                      Found in salt/states/firewalld.py and 1 other location - About 1 hr to fix
                                                                      salt/states/firewalld.py on lines 365..369

                                                                      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

                                                                          try:
                                                                              _current_ports = __salt__['firewalld.get_service_ports'](name)
                                                                          except CommandExecutionError as err:
                                                                              ret['comment'] = 'Error: {0}'.format(err)
                                                                              return ret
                                                                      Severity: Minor
                                                                      Found in salt/states/firewalld.py and 1 other location - About 50 mins to fix
                                                                      salt/states/firewalld.py on lines 290..294

                                                                      Duplicated Code

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

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

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

                                                                      Tuning

                                                                      This issue has a mass of 44.

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

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

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

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

                                                                      Refactorings

                                                                      Further Reading

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

                                                                          try:
                                                                              _current_protocols = __salt__['firewalld.get_service_protocols'](name)
                                                                          except CommandExecutionError as err:
                                                                              ret['comment'] = 'Error: {0}'.format(err)
                                                                              return ret
                                                                      Severity: Minor
                                                                      Found in salt/states/firewalld.py and 1 other location - About 50 mins to fix
                                                                      salt/states/firewalld.py on lines 258..262

                                                                      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