goshippo/shippo-ruby-client

View on GitHub
lib/shippo/api.rb

Summary

Maintainability
A
0 mins
Test Coverage

This conditional expression can just be replaced by Integer(ENV['SHIPPO_DEBUG'] || 0) > 0.
Open

    @debug        = Integer(ENV['SHIPPO_DEBUG'] || 0) > 0 ? true : false
Severity: Minor
Found in lib/shippo/api.rb by rubocop

This cop checks for redundant returning of true/false in conditionals.

Example:

# bad
x == y ? true : false

# bad
if x == y
  true
else
  false
end

# good
x == y

# bad
x == y ? false : true

# good
x != y

Use Integer(ENV['SHIPPO_DEBUG'] || 0).positive? instead of Integer(ENV['SHIPPO_DEBUG'] || 0) > 0.
Open

    @debug        = Integer(ENV['SHIPPO_DEBUG'] || 0) > 0 ? true : false
Severity: Minor
Found in lib/shippo/api.rb 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