Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RuboCop and introduce RuboCop-RSpec #712

Merged
merged 26 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b72c28e
Auto-update rubocop to 0.84.0
mvz May 31, 2020
5cebecd
Enable new cops from RuboCop 0.83 and 0.84
mvz May 31, 2020
283e5d8
Add rubocop-rspec
mvz May 31, 2020
7b7da74
Autocorrect rubocop-rspec offenses
mvz May 31, 2020
4fd1c64
Regenerate RuboCop TODO file
mvz May 31, 2020
bc61e36
Autocorrect Lint/AmbiguousRegexpLiteral
mvz May 31, 2020
d2dd134
Correct RSpec/ExpectActual offense
mvz May 31, 2020
49284a4
Autocorrect Style/RegexpLiteral
mvz May 31, 2020
a0b9361
Fix Style/NumericPredicate offense
mvz May 31, 2020
fc44042
Correct several Style/MethodMissingSuper offenses
mvz May 31, 2020
233740a
Fix Style/IdenticalConditionalBranches offense
mvz May 31, 2020
d6dee7e
Replace eval with simple case statement
mvz May 31, 2020
858c425
Fix Style/CommentedKeyword offense
mvz May 31, 2020
917cdc3
Correct one Style/AccessModifierDeclarations offense
mvz May 31, 2020
5e739ae
Correct RSpec/VoidExpect offenses
mvz May 31, 2020
a00bf63
Fix RSpec/ScatteredSetup offenses
mvz May 31, 2020
dbe959a
Wrap long line
mvz May 31, 2020
b59d30f
Fix RSpec/RepeatedExampleGroupDescription offenses
mvz May 31, 2020
1d3aaa8
Fix RSpec/RepeatedDescription offense
mvz May 31, 2020
9117a1a
Fix RSpec/VerifiedDoubles offense
mvz May 31, 2020
bab8af3
Fix RSpec/NamedSubject offenses
mvz May 31, 2020
ea0053c
Fix RSpec/MessageSpies offense
mvz May 31, 2020
92d2c96
Fix RSpec/LetSetup offenses
mvz May 31, 2020
3b46baa
Fix RSpec/LeakyConstantDeclaration offenses
mvz May 31, 2020
62766b5
Move old spec setup to where it belongs
mvz May 31, 2020
8da2b6a
Regenerate RuboCop TODO file
mvz May 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Correct several Style/MethodMissingSuper offenses
  • Loading branch information
mvz committed Jun 1, 2020
commit fc44042c9bc59d25561309efef419feb7c1a7c6e
3 changes: 0 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,4 @@ Style/IdenticalConditionalBranches:
# Offense count: 5
Style/MethodMissingSuper:
Exclude:
- 'lib/aruba/config_wrapper.rb'
- 'lib/aruba/in_config_wrapper.rb'
- 'lib/aruba/platforms/command_monitor.rb'
- 'lib/aruba/tasks/docker_helpers.rb'
4 changes: 3 additions & 1 deletion lib/aruba/config_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def initialize(config, event_bus)
def method_missing(name, *args, &block)
notify(name, args) if name.to_s.end_with?('=')

config.send(name, *args, &block)
return config.send(name, *args, &block) if config.respond_to? name

super
end

# Pass on respond_to?-calls
Expand Down
15 changes: 7 additions & 8 deletions lib/aruba/in_config_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ def initialize(config)
end

def method_missing(name, *args)
raise ArgumentError, 'Options take no argument' if args.any?
if config.key? name
raise ArgumentError, 'Options take no argument' if args.any?

unless config.key? name
raise UnknownOptionError,
%(Option "#{name}" is unknown. Please use only earlier defined options)
config[name]
else
super
end

config[name]
end

def respond_to_missing?(*)
true
def respond_to_missing?(name, _include_private)
config.key? name
end
end
end
4 changes: 3 additions & 1 deletion lib/aruba/tasks/docker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def initialize(file, instance)
end

def method_missing(m, *_args)
@file.public_send m, instance
return @file.public_send m, instance if @file.respond_to?(m)

super
end

def respond_to_missing?(m)
Expand Down
4 changes: 1 addition & 3 deletions spec/aruba/in_config_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

context 'when option is not defined' do
it 'raises an error' do
expect { wrapper.opt }
.to raise_error ArgumentError,
'Option "opt" is unknown. Please use only earlier defined options'
expect { wrapper.opt }.to raise_error NoMethodError
end
end
end