Skip to content

Commit

Permalink
Suppress RuboCop offenses (rubocop#229)
Browse files Browse the repository at this point in the history
This PR suppresses the following RuboCop offenses.

```console
% bundle exec rake
(snip)

Offenses:

Gemfile:21:4: C: [Correctable] Style/FetchEnvVar:
Use ENV.fetch('RUBOCOP_VERSION') or ENV.fetch('RUBOCOP_VERSION', nil) instead of ENV['RUBOCOP_VERSION'].
if ENV['RUBOCOP_VERSION'] == 'none'
   ^^^^^^^^^^^^^^^^^^^^^^
Gemfile:28:9: C: [Correctable] Style/FetchEnvVar:
Use ENV.fetch('RUBOCOP_VERSION') or ENV.fetch('RUBOCOP_VERSION', nil) instead of ENV['RUBOCOP_VERSION'].
  elsif ENV['RUBOCOP_VERSION'] == 'master'
        ^^^^^^^^^^^^^^^^^^^^^^
lib/rubocop/ast/traversal.rb:37:39: C: [Correctable] Style/FetchEnvVar:
Use ENV.fetch('RUBOCOP_DEBUG') or ENV.fetch('RUBOCOP_DEBUG', nil) instead of ENV['RUBOCOP_DEBUG'].
                         arity_check: ENV['RUBOCOP_DEBUG'] && self.arity_check(arity),
                                      ^^^^^^^^^^^^^^^^^^^^

162 files inspected, 3 offenses detected, 3 offenses auto-correctable
```
  • Loading branch information
koic committed Apr 20, 2022
1 parent 51f938a commit 016a2a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/traversal.rb
Expand Up @@ -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
Expand Down

0 comments on commit 016a2a0

Please sign in to comment.