diff --git a/Gemfile b/Gemfile index 843e166a1..a442681bd 100644 --- a/Gemfile +++ b/Gemfile @@ -18,14 +18,14 @@ gem 'rspec', '~> 3.7' # https://github.com/codeclimate/test-reporter/issues/418 gem 'simplecov', '~> 0.10', '< 0.18' -if ENV['RUBOCOP_VERSION'] == 'none' +if ENV.fetch('RUBOCOP_VERSION', nil) == 'none' # Set this way on CI puts 'Running specs independently of RuboCop' else local_ast = File.expand_path('../rubocop', __dir__) if File.exist?(local_ast) gem 'rubocop', path: local_ast - elsif ENV['RUBOCOP_VERSION'] == 'master' + elsif ENV.fetch('RUBOCOP_VERSION', nil) == 'master' gem 'rubocop', git: 'https://github.com/rubocop/rubocop.git' else gem 'rubocop', '>= 1.0' diff --git a/lib/rubocop/ast/traversal.rb b/lib/rubocop/ast/traversal.rb index 21a61efb4..4aaf65061 100644 --- a/lib/rubocop/ast/traversal.rb +++ b/lib/rubocop/ast/traversal.rb @@ -34,7 +34,7 @@ module CallbackCompiler def def_callback(type, *signature, arity: signature.size..signature.size, - arity_check: ENV['RUBOCOP_DEBUG'] && self.arity_check(arity), + arity_check: ENV.fetch('RUBOCOP_DEBUG', nil) && self.arity_check(arity), body: self.body(signature, arity_check)) type, *aliases = type lineno = caller_locations(1, 1).first.lineno