binamov/iis-lb

View on GitHub

Showing 10 of 10 total issues

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

  iis_config "remove server #{new_resource.server_address} from #{new_resource.farm} server farm" do
    cfg_cmd "-section:webFarms /-\"[name='#{new_resource.farm}'].[address='#{new_resource.server_address}']\" /commit:apphost"
    only_if { shell_out("#{appcmd} search config /section:webFarms /\"[name='#{new_resource.farm}'].[address='#{new_resource.server_address}']\".address").stdout.chomp == 'CONFIGSEARCH "MACHINE/WEBROOT/APPHOST"' }
Severity: Minor
Found in resources/server.rb and 1 other location - About 45 mins to fix
resources/server.rb on lines 13..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 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

  iis_config "add server #{new_resource.server_address} to #{new_resource.farm} server farm" do
    cfg_cmd "-section:webFarms /+\"[name='#{new_resource.farm}'].[address='#{new_resource.server_address}']\" /commit:apphost"
    not_if { shell_out("#{appcmd} search config /section:webFarms /\"[name='#{new_resource.farm}'].[address='#{new_resource.server_address}']\".address").stdout.chomp == 'CONFIGSEARCH "MACHINE/WEBROOT/APPHOST"' }
Severity: Minor
Found in resources/server.rb and 1 other location - About 45 mins to fix
resources/server.rb on lines 29..31

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

  iis_config "create #{new_resource.farm_name} web farm" do
    cfg_cmd "-section:webFarms /+\"[name='#{new_resource.farm_name}']\" /commit:apphost"
    not_if { shell_out("#{appcmd} search config /section:webFarms /\"[name='#{new_resource.farm_name}']\".name").stdout.chomp == 'CONFIGSEARCH "MACHINE/WEBROOT/APPHOST"' }
Severity: Minor
Found in resources/farm.rb and 2 other locations - About 25 mins to fix
resources/farm.rb on lines 20..22
resources/farm.rb on lines 37..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 29.

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

  iis_config "remove #{new_resource.farm_name} web farm" do
    cfg_cmd "-section:webFarms /-\"[name='#{new_resource.farm_name}']\" /commit:apphost"
    only_if { shell_out("#{appcmd} search config /section:webFarms /\"[name='#{new_resource.farm_name}']\".name").stdout.chomp == 'CONFIGSEARCH "MACHINE/WEBROOT/APPHOST"' }
Severity: Minor
Found in resources/farm.rb and 2 other locations - About 25 mins to fix
resources/farm.rb on lines 10..12
resources/farm.rb on lines 20..22

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

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

  iis_config "create url rewrite rule for #{new_resource.farm_name} web farm" do
    cfg_cmd "-section:system.webServer/rewrite/globalRules /+\"[name='ARR_#{new_resource.farm_name}_loadbalance', patternSyntax='Wildcard',stopProcessing='True']\" /commit:apphost"
    not_if { shell_out("#{appcmd} search config /section:system.webServer/rewrite/globalRules /\"[name='ARR_#{new_resource.farm_name}_loadbalance']\".name").stdout.chomp == 'CONFIGSEARCH "MACHINE/WEBROOT/APPHOST"' }
Severity: Minor
Found in resources/farm.rb and 2 other locations - About 25 mins to fix
resources/farm.rb on lines 10..12
resources/farm.rb on lines 37..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 29.

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

Ensure source_url is set in metadata
Open

name 'iis-lb'
Severity: Minor
Found in metadata.rb by foodcritic

This warning is shown if a cookbook does not include the source_url property in its metadata file. source_url is used to point to the source location for the cookbook and is currently parsed by Supermarket to add links to community cookbooks. Note: source_url is a Chef 12 only feature that will cause cookbook failures in Chef 11 so it should be properly gated if the code will be run on Chef 11 hosts.

Ensure issues_url is set in metadata
Open

name 'iis-lb'
Severity: Minor
Found in metadata.rb by foodcritic

This warning is shown if a cookbook does not include the issues_url property in its metadata file. issues_url is used to point to the location for submitting issues (bugs) for the cookbook and is currently parsed by Supermarket to add links to community cookbooks. Note: issues_url is a Chef 12 only feature that will cause cookbook failures in Chef 11 so it should be properly gated if the code will be run on Chef 11 hosts.

%w-literals should be delimited by [ and ].
Open

property :algorithm, String, equal_to: %w(WeightedRoundRobin LeastRequests LeastResponseTime WeightedTotalTraffic RequestHash), default: 'WeightedRoundRobin'
Severity: Minor
Found in resources/farm.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Use meaningful heredoc delimiters.
Open

  EOH
Severity: Minor
Found in recipes/disable_cache.rb by rubocop

This cop checks that your heredocs are using meaningful delimiters. By default it disallows END and EO*, and can be configured through blacklisting additional delimiters.

Example:

# good
<<-SQL
  SELECT * FROM foo
SQL

# bad
<<-END
  SELECT * FROM foo
END

# bad
<<-EOS
  SELECT * FROM foo
EOS

Use meaningful heredoc delimiters.
Open

  EOH
Severity: Minor
Found in recipes/disable_cache.rb by rubocop

This cop checks that your heredocs are using meaningful delimiters. By default it disallows END and EO*, and can be configured through blacklisting additional delimiters.

Example:

# good
<<-SQL
  SELECT * FROM foo
SQL

# bad
<<-END
  SELECT * FROM foo
END

# bad
<<-EOS
  SELECT * FROM foo
EOS
Severity
Category
Status
Source
Language