app/helpers/washout_builder_fault_type_helper.rb
Use casecmp
instead of downcase ==
. Open
Open
attr_details[:primitive].to_s.downcase == 'array' ? member_type_is_basic?(attr_details) : attr_details[:primitive]
- Read upRead up
- Exclude checks
This cop identifies places where a case-insensitive string comparison
can better be implemented using casecmp
.
Example:
# bad
str.downcase == 'abc'
str.upcase.eql? 'ABC'
'abc' == str.downcase
'ABC'.eql? str.upcase
str.downcase == str.downcase
# good
str.casecmp('ABC').zero?
'abc'.casecmp(str).zero?
Use casecmp
instead of downcase ==
. Open
Open
attr_details[:primitive].to_s.downcase == 'nilclass' ? 'string' : attr_details[:primitive].to_s.downcase
- Read upRead up
- Exclude checks
This cop identifies places where a case-insensitive string comparison
can better be implemented using casecmp
.
Example:
# bad
str.downcase == 'abc'
str.upcase.eql? 'ABC'
'abc' == str.downcase
'ABC'.eql? str.upcase
str.downcase == str.downcase
# good
str.casecmp('ABC').zero?
'abc'.casecmp(str).zero?
Prefer to_s
over string interpolation. Open
Open
attribute_primitive = array == true ? "Array of #{attr_primitive}" : "#{attr_primitive}"
- Read upRead up
- Exclude checks
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