BIAndrews/ec2tagfacts

View on GitHub
lib/facter/ec2_tag_facts.rb

Summary

Maintainability
A
0 mins
Test Coverage

Extra empty line detected at begin body end.
Open


end
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin-end blocks.

Example:

# good

begin
  # ...
end

# bad

begin

  # ...

end

Extra empty line detected at begin body beginning.
Open


    # Some edge cases may require multiple attempts to re-run 'aws ec2 describe-tags' due to API rate limits
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin-end blocks.

Example:

# good

begin
  # ...
end

# bad

begin

  # ...

end

Extra empty line detected at block body beginning.
Open


          # Name it and make sure its lower case and convert spaces to understores
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines around the bodies of blocks match the configuration.

Example: EnforcedStyle: empty_lines

# good

foo do |bar|

  # ...

end

Example: EnforcedStyle: noemptylines (default)

# good

foo do |bar|
  # ...
end

Extra empty line detected before the rescue.
Open


  rescue # Ignore if awscli had any issues
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

Example:

# good

begin
  do_something
rescue
  do_something2
else
  do_something3
ensure
  do_something4
end

# good

def foo
  do_something
rescue
  do_something2
end

# bad

begin
  do_something

rescue

  do_something2

else

  do_something3

ensure

  do_something4
end

# bad

def foo
  do_something

rescue

  do_something2
end

Avoid rescuing without specifying an error class.
Open

  rescue # Ignore if awscli had any issues
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

Example: EnforcedStyle: implicit

# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.

# bad
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Example: EnforcedStyle: explicit (default)

# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.

# bad
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Avoid rescuing without specifying an error class.
Open

rescue
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

Example: EnforcedStyle: implicit

# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.

# bad
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Example: EnforcedStyle: explicit (default)

# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.

# bad
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Extra empty line detected at begin body end.
Open


  end
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin-end blocks.

Example:

# good

begin
  # ...
end

# bad

begin

  # ...

end

Extra empty line detected at begin body beginning.
Open


  ################################################################
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin-end blocks.

Example:

# good

begin
  # ...
end

# bad

begin

  # ...

end

Extra empty line detected at block body end.
Open


        end
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines around the bodies of blocks match the configuration.

Example: EnforcedStyle: empty_lines

# good

foo do |bar|

  # ...

end

Example: EnforcedStyle: noemptylines (default)

# good

foo do |bar|
  # ...
end

Extra empty line detected after the rescue.
Open


  debug_msg("This is not an AWS EC2 instance or unable to contact the AWS instance-data web server.")
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

Example:

# good

begin
  do_something
rescue
  do_something2
else
  do_something3
ensure
  do_something4
end

# good

def foo
  do_something
rescue
  do_something2
end

# bad

begin
  do_something

rescue

  do_something2

else

  do_something3

ensure

  do_something4
end

# bad

def foo
  do_something

rescue

  do_something2
end

Prefer to_s over string interpolation.
Open

          Facter.add("#{fact}") do
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cop checks for strings that are just an interpolated expression.

Example:

# bad
"#{@var}"

# good
@var.to_s

# good if @var is already a String
@var

Extra empty line detected after the rescue.
Open


    debug_msg("awscli exec failed")
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

Example:

# good

begin
  do_something
rescue
  do_something2
else
  do_something3
ensure
  do_something4
end

# good

def foo
  do_something
rescue
  do_something2
end

# bad

begin
  do_something

rescue

  do_something2

else

  do_something3

ensure

  do_something4
end

# bad

def foo
  do_something

rescue

  do_something2
end

Extra empty line detected before the rescue.
Open


rescue
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

Example:

# good

begin
  do_something
rescue
  do_something2
else
  do_something3
ensure
  do_something4
end

# good

def foo
  do_something
rescue
  do_something2
end

# bad

begin
  do_something

rescue

  do_something2

else

  do_something3

ensure

  do_something4
end

# bad

def foo
  do_something

rescue

  do_something2
end

Useless assignment to variable - i.
Open

    for i in 1..6
Severity: Minor
Found in lib/facter/ec2_tag_facts.rb by rubocop

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

There are no issues that match your filters.

Category
Status