spec/support/shared_examples/repository_behavior.rb
Indent the first argument one step more than hash_including(
. Open
Open
number_of_shards: 1,
number_of_replicas: 1
- Read upRead up
- Exclude checks
Checks the indentation of the first argument in a method call.
Arguments after the first one are checked by Layout/ArgumentAlignment
,
not by this cop.
For indenting the first parameter of method definitions, check out
Layout/FirstParameterIndentation
.
This cop will respect Layout/ArgumentAlignment
and will not work when
EnforcedStyle: with_fixed_indentation
is specified for Layout/ArgumentAlignment
.
Example:
# bad
some_method(
first_param,
second_param)
foo = some_method(
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_param
Example: EnforcedStyle: specialforinnermethodcallinparentheses (default)
# Same as `special_for_inner_method_call` except that the special rule
# only applies if the outer method call encloses its arguments in
# parentheses.
# good
some_method(
first_param,
second_param)
foo = some_method(
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_param
Example: EnforcedStyle: consistent
# The first argument should always be indented one step more than the
# preceding line.
# good
some_method(
first_param,
second_param)
foo = some_method(
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_param
Example: EnforcedStyle: consistentrelativeto_receiver
# The first argument should always be indented one level relative to
# the parent that is receiving the argument
# good
some_method(
first_param,
second_param)
foo = some_method(
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_params
Example: EnforcedStyle: specialforinnermethodcall
# The first argument should normally be indented one step more than
# the preceding line, but if it's a argument for a method call that
# is itself a argument in a method call, then the inner argument
# should be indented relative to the inner method.
# good
some_method(
first_param,
second_param)
foo = some_method(
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_param
Space inside empty hash literal braces detected. Open
Open
'_source' => { }
- Read upRead up
- Exclude checks
Checks that braces used for hash literals have or don't have surrounding space depending on configuration.
Example: EnforcedStyle: space (default)
# The `space` style enforces that hash literals have
# surrounding space.
# bad
h = {a: 1, b: 2}
# good
h = { a: 1, b: 2 }
Example: EnforcedStyle: no_space
# The `no_space` style enforces that hash literals have
# no surrounding space.
# bad
h = { a: 1, b: 2 }
# good
h = {a: 1, b: 2}
Example: EnforcedStyle: compact
# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.
# bad
h = { a: { b: 2 } }
foo = { { a: 1 } => { b: { c: 2 } } }
# good
h = { a: { b: 2 }}
foo = {{ a: 1 } => { b: { c: 2 }}}
Example: EnforcedStyleForEmptyBraces: no_space (default)
# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# empty hash braces do not contain spaces.
# bad
foo = { }
bar = { }
baz = {
}
# good
foo = {}
bar = {}
baz = {}
Example: EnforcedStyleForEmptyBraces: space
# The `space` EnforcedStyleForEmptyBraces style enforces that
# empty hash braces contain space.
# bad
foo = {}
# good
foo = { }
foo = { }
foo = {
}