jhh/firewalld-cookbook

View on GitHub

Showing 17 of 17 total issues

Method rich_rule has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def rich_rule
    cmd = "rule "
    cmd += "family='#{new_resource.family}' " if new_resource.family
    cmd += "source address='#{new_resource.source_address}' " if new_resource.source_address
    cmd += "destination address='#{new_resource.destination_address}' " if new_resource.destination_address
Severity: Minor
Found in providers/rich_rule.rb - 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

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

action :add do
    e = execute "add forward port #{new_resource.port}:#{new_resource.protocol} => #{new_resource.to_port} #{new_resource.address}" do
        not_if "firewall-cmd --query-forward-port=port=#{new_resource.port}:proto=#{new_resource.protocol}:toport=#{new_resource.to_port}#{address}"
        command(firewall_command(:add))
    end
Severity: Minor
Found in providers/forward.rb and 1 other location - About 55 mins to fix
providers/forward.rb on lines 18..24

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

action :remove do
    e = execute "remove forward port #{new_resource.port}:#{new_resource.protocol} => #{new_resource.to_port} #{new_resource.address}" do
        only_if "firewall-cmd --query-forward-port=port=#{new_resource.port}:proto=#{new_resource.protocol}:toport=#{new_resource.to_port}#{address}"
        command(firewall_command(:remove))
    end
Severity: Minor
Found in providers/forward.rb and 1 other location - About 55 mins to fix
providers/forward.rb on lines 9..15

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

action :remove do
  e = execute "remove port #{new_resource.port} from zone" do
    only_if "firewall-cmd --permanent #{zone} --query-port=#{new_resource.port}"
    command(<<-EOC)
      firewall-cmd #{zone} --remove-port=#{new_resource.port}
Severity: Major
Found in providers/port.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :remove do
  e = execute "remove source #{new_resource.source} from zone" do
    only_if "firewall-cmd --permanent #{zone} --query-source=#{new_resource.source}"
    command(<<-EOC)
      firewall-cmd #{zone} --remove-source=#{new_resource.source}
Severity: Major
Found in providers/source.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :add do
  e = execute "add source #{new_resource.source} to zone" do
    not_if "firewall-cmd --permanent #{zone} --query-source=#{new_resource.source}"
    command(<<-EOC)
      firewall-cmd #{zone} --add-source=#{new_resource.source}
Severity: Major
Found in providers/source.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :change do
  e = execute "change source #{new_resource.source} to zone" do
    not_if "firewall-cmd --permanent #{zone} --query-source=#{new_resource.source}"
    command(<<-EOC)
      firewall-cmd #{zone} --change-source=#{new_resource.source}
Severity: Major
Found in providers/source.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :remove do
  e = execute "remove service #{new_resource.service} from zone" do
    only_if "firewall-cmd --permanent #{zone} --query-service=#{new_resource.service}"
    command(<<-EOC)
      firewall-cmd #{zone} --remove-service=#{new_resource.service}
Severity: Major
Found in providers/service.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :add do
  e = execute "add interface #{new_resource.interface} to zone" do
    not_if "firewall-cmd --permanent #{zone} --query-interface=#{new_resource.interface}"
    command(<<-EOC)
      firewall-cmd #{zone} --add-interface=#{new_resource.interface}
Severity: Major
Found in providers/interface.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :add do
  e = execute "add port #{new_resource.port} to zone" do
    not_if "firewall-cmd --permanent #{zone} --query-port=#{new_resource.port}"
    command(<<-EOC)
      firewall-cmd #{zone} --add-port=#{new_resource.port}
Severity: Major
Found in providers/port.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :change do
  e = execute "change interface #{new_resource.interface} to zone" do
    not_if "firewall-cmd --permanent #{zone} --query-interface=#{new_resource.interface}"
    command(<<-EOC)
      firewall-cmd #{zone} --change-interface=#{new_resource.interface}
Severity: Major
Found in providers/interface.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :add do
  e = execute "add service #{new_resource.service} to zone" do
    not_if "firewall-cmd --permanent #{zone} --query-service=#{new_resource.service}"
    command(<<-EOC)
      firewall-cmd #{zone} --add-service=#{new_resource.service}
Severity: Major
Found in providers/service.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/interface.rb on lines 31..39
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :remove do
  e = execute "remove interface #{new_resource.interface} from zone" do
    only_if "firewall-cmd --permanent #{zone} --query-interface=#{new_resource.interface}"
    command(<<-EOC)
      firewall-cmd #{zone} --remove-interface=#{new_resource.interface}
Severity: Major
Found in providers/interface.rb and 9 other locations - About 45 mins to fix
providers/interface.rb on lines 9..17
providers/interface.rb on lines 20..28
providers/port.rb on lines 9..17
providers/port.rb on lines 20..28
providers/service.rb on lines 9..17
providers/service.rb on lines 20..28
providers/source.rb on lines 9..17
providers/source.rb on lines 20..28
providers/source.rb on lines 31..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 41.

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

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

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

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

Refactorings

Further Reading

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

action :add do
  e = execute "add port #{new_resource.name} to zone" do
    not_if "firewall-cmd #{zone} --query-rich-rule=\"#{rich_rule}\""
    command(<<-EOC)
    firewall-cmd #{zone} --add-rich-rule="#{rich_rule}"
Severity: Minor
Found in providers/rich_rule.rb and 1 other location - About 45 mins to fix
providers/rich_rule.rb on lines 20..28

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

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

action :remove do
  e = execute "remove port #{new_resource.name} from zone" do
    only_if "firewall-cmd #{zone} --query-rich-rule=\"#{rich_rule}\""
    command(<<-EOC)
    firewall-cmd #{zone} --remove-rich-rule="#{rich_rule}"
Severity: Minor
Found in providers/rich_rule.rb and 1 other location - About 45 mins to fix
providers/rich_rule.rb on lines 9..17

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

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

action :add do
  e = execute "add masquerade to #{new_resource.zone} zone" do
    not_if "firewall-cmd --permanent --zone=#{new_resource.zone} --query-masquerade"
    command(<<-EOC)
      firewall-cmd --zone=#{new_resource.zone} --add-masquerade
Severity: Minor
Found in providers/masquerade.rb and 1 other location - About 30 mins to fix
providers/masquerade.rb on lines 20..28

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

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

action :remove do
  e = execute "remove masquerade from #{new_resource.zone} zone" do
    only_if "firewall-cmd --permanent --zone=#{new_resource.zone} --query-masquerade"
    command(<<-EOC)
      firewall-cmd --zone=#{new_resource.zone} --remove-masquerade
Severity: Minor
Found in providers/masquerade.rb and 1 other location - About 30 mins to fix
providers/masquerade.rb on lines 9..17

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

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

Severity
Category
Status
Source
Language