Skip to content

Commit

Permalink
Avoid rubocop comments appearing in YARD-generated docs
Browse files Browse the repository at this point in the history
By using the single-line version.

Note that the comment still shows up in the source code in the
documentation, but since this is hidden by default, I think this is less
of an issue.

My attention was drawn to this by @nitishr in a commit in #427.
  • Loading branch information
floehopper committed Dec 22, 2019
1 parent 6296fd5 commit d8019ee
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
5 changes: 2 additions & 3 deletions lib/mocha/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def self.extended(mod)
# assert motor.stop
# # an error will be raised unless both Motor#start and Motor#stop have been called
# end
# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
def mock(*arguments)
#
def mock(*arguments) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
if Mocha.configuration.reinstate_undocumented_behaviour_from_v1_9?
if arguments.first.is_a?(Symbol)
method_name = arguments[0]
Expand All @@ -91,7 +91,6 @@ def mock(*arguments)
mock.expects(expectations)
mock
end
# rubocop:enable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity

# Builds a new mock object
#
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/parameter_matchers/has_entries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ module ParameterMatchers
# object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
# object.method_1('key_1' => 1, 'key_2' => 99)
# # error raised, because method_1 was not called with Hash containing entries: 'key_1' => 1, 'key_2' => 2
# rubocop:disable Naming/PredicateName
def has_entries(entries)
#
def has_entries(entries) # rubocop:disable Naming/PredicateName
HasEntries.new(entries)
end
# rubocop:enable Naming/PredicateName

# Parameter matcher which matches when actual parameter contains all expected +Hash+ entries.
class HasEntries < Base
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/parameter_matchers/has_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module ParameterMatchers
# object.expects(:method_1).with(has_entry('key_1' => 1))
# object.method_1('key_1' => 2, 'key_2' => 1)
# # error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
# rubocop:disable Naming/PredicateName
def has_entry(*options)
#
def has_entry(*options) # rubocop:disable Naming/PredicateName
case options.length
when 1
case options[0]
Expand All @@ -63,7 +63,6 @@ def has_entry(*options)
end
HasEntry.new(key, value)
end
# rubocop:enable Naming/PredicateName

# Parameter matcher which matches when actual parameter contains expected +Hash+ entry.
class HasEntry < Base
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/parameter_matchers/has_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ module ParameterMatchers
# object.expects(:method_1).with(has_key('key_1'))
# object.method_1('key_2' => 2)
# # error raised, because method_1 was not called with Hash containing key: 'key_1'
# rubocop:disable Naming/PredicateName
def has_key(key)
#
def has_key(key) # rubocop:disable Naming/PredicateName
HasKey.new(key)
end
# rubocop:enable Naming/PredicateName

# Parameter matcher which matches when actual parameter contains +Hash+ entry with expected key.
class HasKey < Base
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/parameter_matchers/has_value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ module ParameterMatchers
# object.expects(:method_1).with(has_value(1))
# object.method_1('key_2' => 2)
# # error raised, because method_1 was not called with Hash containing value: 1
# rubocop:disable Naming/PredicateName
def has_value(value)
#
def has_value(value) # rubocop:disable Naming/PredicateName
HasValue.new(value)
end
# rubocop:enable Naming/PredicateName

# Parameter matcher which matches when actual parameter contains +Hash+ entry with expected value.
class HasValue < Base
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/parameter_matchers/is_a.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ module ParameterMatchers
# object.expects(:method_1).with(is_a(Integer))
# object.method_1('string')
# # error raised, because method_1 was not called with an Integer
# rubocop:disable Naming/PredicateName
def is_a(klass)
#
def is_a(klass) # rubocop:disable Naming/PredicateName
IsA.new(klass)
end
# rubocop:enable Naming/PredicateName

# Parameter matcher which matches when actual parameter is a specific class.
class IsA < Base
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/parameter_matchers/not.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ module ParameterMatchers
# object.expects(:method_1).with(Not(includes(1)))
# object.method_1([0, 1, 2, 3])
# # error raised, because method_1 was not called with object not including 1
# rubocop:disable Naming/MethodName
def Not(matcher)
#
def Not(matcher) # rubocop:disable Naming/MethodName
Not.new(matcher)
end
# rubocop:enable Naming/MethodName

# Parameter matcher which inverts the logic of the specified matcher using a logical NOT operation.
class Not < Base
Expand Down
5 changes: 2 additions & 3 deletions lib/mocha/state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ def is(state_name)
end

# Provides a mechanism to determine whether the {StateMachine} is not in the state specified by +state_name+ at some point in the future.
# rubocop:disable Naming/PredicateName
def is_not(state_name)
#
def is_not(state_name) # rubocop:disable Naming/PredicateName
StatePredicate.new(self, state_name)
end
# rubocop:enable Naming/PredicateName

# @private
def mocha_inspect
Expand Down

0 comments on commit d8019ee

Please sign in to comment.