Align the elements of an array literal if they span more than one line. Open
:distance_kind, :destination, :origin].each { |n| attribute n, String }
- Read upRead up
- Exclude checks
Here we check if the elements of a multi-line array literal are aligned.
Example:
# bad
a = [1, 2, 3,
4, 5, 6]
array = ['run',
'forrest',
'run']
# good
a = [1, 2, 3,
4, 5, 6]
a = ['run',
'forrest',
'run']
Align the elements of an array literal if they span more than one line. Open
:destination_latitude, :destination_longitude, :origin_longitude,
- Read upRead up
- Exclude checks
Here we check if the elements of a multi-line array literal are aligned.
Example:
# bad
a = [1, 2, 3,
4, 5, 6]
array = ['run',
'forrest',
'run']
# good
a = [1, 2, 3,
4, 5, 6]
a = ['run',
'forrest',
'run']
Align the elements of an array literal if they span more than one line. Open
:origin_latitude].each { |n| attribute n, Decimal }
- Read upRead up
- Exclude checks
Here we check if the elements of a multi-line array literal are aligned.
Example:
# bad
a = [1, 2, 3,
4, 5, 6]
array = ['run',
'forrest',
'run']
# good
a = [1, 2, 3,
4, 5, 6]
a = ['run',
'forrest',
'run']
Use %i
or %I
for an array of symbols. Open
[:id, :attachments_count, :comments_count, :activities_count,
:travel_time, :pre_expense_id].each { |n| attribute n, Integer }
- 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]
Use %i
or %I
for an array of symbols. Open
[:amount, :approved_amount, :latitude, :longitude, :distance,
:destination_latitude, :destination_longitude, :origin_longitude,
:origin_latitude].each { |n| attribute n, Decimal }
- 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]
Align the elements of an array literal if they span more than one line. Open
:travel_time, :pre_expense_id].each { |n| attribute n, Integer }
- Read upRead up
- Exclude checks
Here we check if the elements of a multi-line array literal are aligned.
Example:
# bad
a = [1, 2, 3,
4, 5, 6]
array = ['run',
'forrest',
'run']
# good
a = [1, 2, 3,
4, 5, 6]
a = ['run',
'forrest',
'run']
Use %i
or %I
for an array of symbols. Open
[:description, :currency, :approved_amount_currency, :kind, :status,
:distance_kind, :destination, :origin].each { |n| attribute n, String }
- 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]