lib/rubocop/cop/style/special_global_vars.rb in rubocop-0.75.1 vs lib/rubocop/cop/style/special_global_vars.rb in rubocop-0.76.0
- old
+ new
@@ -158,20 +158,18 @@
format_message(english, regular, global_var)
end
def format_message(english, regular, global)
- if !regular.empty? && !english.empty?
+ if regular.empty?
+ format(MSG_ENGLISH, prefer: format_list(english), global: global)
+ elsif english.empty?
+ format(MSG_REGULAR, prefer: format_list(regular), global: global)
+ else
format(MSG_BOTH,
prefer: format_list(english),
regular: format_list(regular),
global: global)
- elsif !regular.empty?
- format(MSG_REGULAR, prefer: format_list(regular), global: global)
- elsif !english.empty?
- format(MSG_ENGLISH, prefer: format_list(english), global: global)
- else
- raise 'Bug in SpecialGlobalVars - global var w/o preferred vars!'
end
end
# For now, we assume that lists are 2 items or less. Easy grammar!
def format_list(items)