lib/rubocop/cop/style/special_global_vars.rb in rubocop-0.49.1 vs lib/rubocop/cop/style/special_global_vars.rb in rubocop-0.50.0
- old
+ new
@@ -45,12 +45,12 @@
Hash[ENGLISH_VARS.flat_map { |_, vs| vs.map { |v| [v, [v]] } }]
)
PERL_VARS.merge!(
Hash[PERL_VARS.flat_map { |_, vs| vs.map { |v| [v, [v]] } }]
)
- ENGLISH_VARS.each { |_, v| v.freeze }.freeze
- PERL_VARS.each { |_, v| v.freeze }.freeze
+ ENGLISH_VARS.each_value(&:freeze).freeze
+ PERL_VARS.each_value(&:freeze).freeze
# Anything *not* in this set is provided by the English library.
NON_ENGLISH_VARS = Set.new(%i[
$LOAD_PATH
$LOADED_FEATURES
@@ -65,10 +65,10 @@
if preferred.include?(global_var)
correct_style_detected
else
opposite_style_detected
- add_offense(node, :expression)
+ add_offense(node)
end
end
def message(node)
global_var, = *node