uniak/puppet-networkdevice

View on GitHub

Showing 46 of 98 total issues

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

Puppet::Type.type(:cisco_radius_server).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for Radius-Server Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_radius_server/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_aaa_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_archive/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_user/cisco_ios.rb on lines 3..18

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

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

Puppet::Type.type(:cisco_archive).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for Archive Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_archive/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_aaa_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_radius_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_user/cisco_ios.rb on lines 3..18

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

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

Puppet::Type.type(:cisco_snmp_server).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for SNMP Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_snmp_server/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_aaa_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_archive/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_radius_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_user/cisco_ios.rb on lines 3..18

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

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

Puppet::Type.type(:cisco_user).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for User Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_user/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_aaa_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_archive/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_radius_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb on lines 3..18

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

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

Puppet::Type.type(:cisco_snmp_server_view).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for SNMP Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_aaa_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_archive/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_radius_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_user/cisco_ios.rb on lines 3..18

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

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

Puppet::Type.type(:cisco_snmp_server_user).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for SNMP Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_aaa_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_archive/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_radius_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_user/cisco_ios.rb on lines 3..18

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

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

Puppet::Type.type(:cisco_aaa_group).provide :cisco_ios, :parent => Puppet::Provider::Cisco_ios do
  desc "Cisco Switch / Router Provider for Device Configuration."
  mk_resource_methods

  def initialize(device, *args)
Severity: Major
Found in lib/puppet/provider/cisco_aaa_group/cisco_ios.rb and 13 other locations - About 40 mins to fix
lib/puppet/provider/cisco_acl/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_archive/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_interface/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_line/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_radius_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_community/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_group/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_host/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_trap/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_user/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_snmp_server_view/cisco_ios.rb on lines 3..18
lib/puppet/provider/cisco_user/cisco_ios.rb on lines 3..18

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

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

    validate do |value|
      if resource.value(:mode) == :access and value == :absent
        raise ArgumentError, "Must set vlan number or sticky if mode is access"
      elsif resource.value(:mode) != :access and value != :absent
        raise ArgumentError, "May only be set if mode is access"
Severity: Minor
Found in lib/puppet/type/cisco_interface.rb and 1 other location - About 35 mins to fix
lib/puppet/type/cisco_interface.rb on lines 59..66

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

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

    validate do |value|
      if resource.value(:mode) == :trunk and value == :absent
        raise ArgumentError, "Must set encapsulation if mode is trunk"
      elsif resource.value(:mode) != :trunk and value != :absent
        raise ArgumentError, "May only be set if mode is trunk"
Severity: Minor
Found in lib/puppet/type/cisco_interface.rb and 1 other location - About 35 mins to fix
lib/puppet/type/cisco_interface.rb on lines 29..36

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

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

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

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

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

Refactorings

Further Reading

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

  newproperty(:trunk_native_vlan) do
    desc "Set native VLAN when interface is in trunking mode"
    defaultto(:absent)
    newvalues(:absent, /^\d+$/)

Severity: Minor
Found in lib/puppet/type/cisco_interface.rb and 2 other locations - About 30 mins to fix
lib/puppet/type/cisco_interface.rb on lines 40..50
lib/puppet/type/cisco_interface.rb on lines 192..203

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

  newproperty(:trunk_allowed_vlan) do
    desc "List of allowed VLANs on this interface"
    defaultto(:absent)
    newvalues(:absent, /^(\d+(-\d+)?,)*\d+(-\d+)?$/)

Severity: Minor
Found in lib/puppet/type/cisco_interface.rb and 2 other locations - About 30 mins to fix
lib/puppet/type/cisco_interface.rb on lines 70..80
lib/puppet/type/cisco_interface.rb on lines 192..203

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

  newproperty(:spanning_tree_cost) do
    desc "The STP port priority"

    defaultto(:absent)
    newvalues(:absent, /^\d*$/)
Severity: Minor
Found in lib/puppet/type/cisco_interface.rb and 2 other locations - About 30 mins to fix
lib/puppet/type/cisco_interface.rb on lines 40..50
lib/puppet/type/cisco_interface.rb on lines 70..80

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

  def archive(name)
    unless params[:archive]
      params[:archive] = Puppet::Util::NetworkDevice::Cisco_ios::Model::Archive.new(transport, facts, { :name => name })
      params[:archive].evaluate_new_params
    end
Severity: Minor
Found in lib/puppet/util/network_device/cisco_ios/model/switch.rb and 1 other location - About 25 mins to fix
lib/puppet/util/network_device/cisco_ios/model/switch.rb on lines 80..85

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

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

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

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

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

Refactorings

Further Reading

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

  def snmp(name)
    unless params[:snmp]
      params[:snmp] = Puppet::Util::NetworkDevice::Cisco_ios::Model::Snmp.new(transport, facts, {:name => name})
      params[:snmp].evaluate_new_params
    end
Severity: Minor
Found in lib/puppet/util/network_device/cisco_ios/model/switch.rb and 1 other location - About 25 mins to fix
lib/puppet/util/network_device/cisco_ios/model/switch.rb on lines 88..93

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

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

    ifprop(base, :dhcp_snooping_trust) do
      match do |txt|
        txt.match(/^\s*ip dhcp snooping trust\s*$/) ? :present : :absent
      end
      add do |transport, _|
lib/puppet/util/network_device/cisco_ios/model/archive/base.rb on lines 27..35
lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb on lines 58..66
lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb on lines 74..82

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

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

    snmp_prop(base, :manager) do
      match do |txt|
        txt.match(/^snmp-server manager$/) ? :present : :absent
      end
      add do |transport, _|
Severity: Minor
Found in lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb and 3 other locations - About 15 mins to fix
lib/puppet/util/network_device/cisco_ios/model/archive/base.rb on lines 27..35
lib/puppet/util/network_device/cisco_ios/model/interface/base.rb on lines 127..135
lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb on lines 74..82

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

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

    archive_prop(base, :write_memory) do
      match do |txt|
        txt.match(/write-memory/) ? :present : :absent
      end
      add do |transport, _|
Severity: Minor
Found in lib/puppet/util/network_device/cisco_ios/model/archive/base.rb and 3 other locations - About 15 mins to fix
lib/puppet/util/network_device/cisco_ios/model/interface/base.rb on lines 127..135
lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb on lines 58..66
lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb on lines 74..82

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

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

    snmp_prop(base, :system_shutdown) do
      match do |txt|
        txt.match(/^snmp-server system-shutdown$/) ? :present : :absent
      end
      add do |transport, _|
Severity: Minor
Found in lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb and 3 other locations - About 15 mins to fix
lib/puppet/util/network_device/cisco_ios/model/archive/base.rb on lines 27..35
lib/puppet/util/network_device/cisco_ios/model/interface/base.rb on lines 127..135
lib/puppet/util/network_device/cisco_ios/model/snmp/base.rb on lines 58..66

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

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

  newproperty(:udp_port) do
    desc "The notification host's UDP port number (default port 162)"
    newvalues(:absent, /^\d+$/)
    validate do |value|
      self.fail "'snmp-server host * * udp-port' must be between 0-65535" unless value.to_i <= 65535 && value.to_i >= 0
Severity: Minor
Found in lib/puppet/type/cisco_snmp_server_host.rb and 5 other locations - About 15 mins to fix
lib/puppet/type/cisco_snmp_server.rb on lines 76..81
lib/puppet/type/cisco_snmp_server.rb on lines 84..89
lib/puppet/type/cisco_snmp_server.rb on lines 92..97
lib/puppet/type/cisco_snmp_server.rb on lines 100..105
lib/puppet/type/cisco_snmp_server.rb on lines 108..113

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

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

  newproperty(:inform_timeout) do
    desc "Set timeout for informs"
    newvalues(:absent, /\d+/)
    validate do |value|
      self.fail "'snmp-server inform timeout' must be between 1-4294967295" unless value.to_i <= 4294967295 && value.to_i >= 1
Severity: Minor
Found in lib/puppet/type/cisco_snmp_server.rb and 5 other locations - About 15 mins to fix
lib/puppet/type/cisco_snmp_server.rb on lines 76..81
lib/puppet/type/cisco_snmp_server.rb on lines 84..89
lib/puppet/type/cisco_snmp_server.rb on lines 100..105
lib/puppet/type/cisco_snmp_server.rb on lines 108..113
lib/puppet/type/cisco_snmp_server_host.rb on lines 31..36

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

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