lib/active_mocker/loaded_mocks.rb
Avoid multi-line chains of blocks. (https://github.com/bbatsov/ruby-style-guide#single-line-blocks) Open
Open
end.any? { |a| a }
- Read upRead up
- Exclude checks
This cop checks for chaining of a block after another block that spans multiple lines.
Example:
Thread.list.find_all do |t|
t.alive?
end.map do |t|
t.object_id
end
Method ActiveMocker::LoadedMocks.mocks
is defined at both lib/active_mocker/loaded_mocks.rb:17 and lib/active_mocker/loaded_mocks.rb:77. Open
Open
def mocks
- Read upRead up
- Exclude checks
This cop checks for duplicated instance (or singleton) method definitions.
Example:
# bad
def duplicated
1
end
def duplicated
2
end
Example:
# bad
def duplicated
1
end
alias duplicated other_duplicated
Example:
# good
def duplicated
1
end
def other_duplicated
2
end
Use %i
or %I
for an array of symbols. (https://github.com/bbatsov/ruby-style-guide#percent-i) Open
Open
if [:to_str, :to_sym].any? { |i| e.respond_to? i }
- Read upRead up
- Exclude checks
This cop can check for array literals made up of symbols that are not using the %i() syntax.
Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.
Configuration option: MinSize
If set, arrays with fewer elements than this value will not trigger the
cop. For example, a MinSize of
3` will not enforce a style on an array
of 2 or fewer elements.
Example: EnforcedStyle: percent (default)
# good
%i[foo bar baz]
# bad
[:foo, :bar, :baz]
Example: EnforcedStyle: brackets
# good
[:foo, :bar, :baz]
# bad
%i[foo bar baz]
Line is too long. [123/120] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
Open
# Input ActiveRecord Model Name as String or Symbol and it returns everything but that ActiveMock equivalent class.
- Exclude checks
Line is too long. [124/120] (https://github.com/bbatsov/ruby-style-guide#80-character-limits) Open
Open
# @param [Array<Symbol, String, ActiveMocker::Mock>] args an array of ActiveRecord Model Names as Strings or Symbols
- Exclude checks