18F/dolores-landingham-slack-bot

View on GitHub
lib/tasks/on_first_instance.rake

Summary

Maintainability
Test Coverage

Avoid using rescue in its modifier form.
Open

    instance_index = JSON.parse(ENV["VCAP_APPLICATION"])["instance_index"] rescue nil
Severity: Minor
Found in lib/tasks/on_first_instance.rake by rubocop

This cop checks for uses of rescue in its modifier form.

Example:

# bad
some_method rescue handle_error

# good
begin
  some_method
rescue
  handle_error
end

Line is too long. [85/80]
Open

    instance_index = JSON.parse(ENV["VCAP_APPLICATION"])["instance_index"] rescue nil
Severity: Minor
Found in lib/tasks/on_first_instance.rake by rubocop

Use instance_index.zero? instead of instance_index == 0.
Open

    exit(0) unless instance_index == 0
Severity: Minor
Found in lib/tasks/on_first_instance.rake by rubocop

This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

Example: EnforcedStyle: predicate (default)

# bad

foo == 0
0 > foo
bar.baz > 0

# good

foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad

foo.zero?
foo.negative?
bar.baz.positive?

# good

foo == 0
0 > foo
bar.baz > 0

There are no issues that match your filters.

Category
Status