tombuildsstuff/sensu-plugins-azurerm

View on GitHub

Showing 25 of 25 total issues

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

class CheckAzureRMRouteTablesUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-route-tables-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMCoresDSUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-cores-ds-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMCoresFSUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-cores-fs-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMCoresDUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-cores-d-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMVMUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-virtual-machines-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMCoresFUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-cores-f-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMCoresDv2Usage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-cores-dv2-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMStaticPublicIPAddressesUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-static-public-ip-addresses-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMVirtualNetworksUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-virtual-networks-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121

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

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

class CheckAzureRMCoresDSv2Usage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-cores-dsv2-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMNetworkInterfacesUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-network-interfaces-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMPublicIPAddressesUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-public-ip-addresses-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMNetworkSecurityGroupsUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-network-security-groups-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMLoadBalancersUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-load-balancers-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-core-usage.rb on lines 50..121
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

class CheckAzureRMCoreUsage < Sensu::Plugin::Check::CLI
  include SensuPluginsAzureRM

  option :tenant_id,
         description: 'ARM Tenant ID. Either set ENV[\'ARM_TENANT_ID\'] or provide it as an option',
Severity: Major
Found in bin/check-azurerm-core-usage.rb and 14 other locations - About 5 hrs to fix
bin/check-azurerm-cores-d-usage.rb on lines 50..121
bin/check-azurerm-cores-ds-usage.rb on lines 50..121
bin/check-azurerm-cores-dsv2-usage.rb on lines 50..121
bin/check-azurerm-cores-dv2-usage.rb on lines 50..121
bin/check-azurerm-cores-f-usage.rb on lines 51..122
bin/check-azurerm-cores-fs-usage.rb on lines 50..121
bin/check-azurerm-load-balancers-usage.rb on lines 50..121
bin/check-azurerm-network-interfaces-usage.rb on lines 50..121
bin/check-azurerm-network-security-groups-usage.rb on lines 50..121
bin/check-azurerm-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-route-tables-usage.rb on lines 50..121
bin/check-azurerm-static-public-ip-addresses-usage.rb on lines 50..121
bin/check-azurerm-virtual-machines-usage.rb on lines 50..121
bin/check-azurerm-virtual-networks-usage.rb on lines 50..121

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

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

File check-azurerm-monitor-metric.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'ms_rest_azure'
require 'erb'

require 'sensu-plugin/check/cli'
require 'sensu-plugins-azurerm'
Severity: Minor
Found in bin/check-azurerm-monitor-metric.rb - About 4 hrs to fix

    Method run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        check_missing_resource_info
    
        if !config[:critical_over] && !config[:warning_over] && !config[:critical_under] && !config[:warning_under]
          unknown 'At least one threshold must be provided.'
    Severity: Minor
    Found in bin/check-azurerm-monitor-metric.rb - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method metric_response has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def metric_response
        auth_header = if config[:use_assigned_identity]
                        uri = URI.parse("http://localhost:#{config[:local_auth_port]}/oauth2/token?resource=#{config[:assigned_identity_resource]}")
    
                        res = Net::HTTP.start(uri.host, uri.port, use_ssl: false) do |http|
    Severity: Minor
    Found in bin/check-azurerm-monitor-metric.rb - About 1 hr to fix

      Method run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def run
          check_missing_resource_info
      
          if !config[:critical_over] && !config[:warning_over] && !config[:critical_under] && !config[:warning_under]
            unknown 'At least one threshold must be provided.'
      Severity: Minor
      Found in bin/check-azurerm-monitor-metric.rb - About 1 hr to fix

        Method find_last_metric_values has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def find_last_metric_values
            values = []
            metric_response[:value].each do |metric_resp_value|
              name = metric_resp_value[:name] ? metric_resp_value[:name][:value] : ''
        
        
        Severity: Minor
        Found in bin/check-azurerm-monitor-metric.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

        Severity
        Category
        Status
        Source
        Language