Block has too many lines. [35/25] Open
json.match do
json.id @ongoing_match.to_param
json.home_score @ongoing_match.home_score
json.home_player_name @ongoing_match.home_player.try!(:nickname) || @ongoing_match.home_player.try!(:name)
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Use safe navigation (&.
) instead of try!
. Open
points.first.try!(:victor) == @ongoing_match.home_player &&
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
Use safe navigation (&.
) instead of try!
. Open
json.away_player_name @ongoing_match.away_player.try!(:nickname) || @ongoing_match.away_player.try!(:name)
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
Use safe navigation (&.
) instead of try!
. Open
json.home_player_name @ongoing_match.home_player.try!(:nickname) || @ongoing_match.home_player.try!(:name)
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
Use safe navigation (&.
) instead of try!
. Open
json.away_player_name @ongoing_match.away_player.try!(:nickname) || @ongoing_match.away_player.try!(:name)
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
Use safe navigation (&.
) instead of try!
. Open
json.home_player_name @ongoing_match.home_player.try!(:nickname) || @ongoing_match.home_player.try!(:name)
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
Use safe navigation (&.
) instead of try!
. Open
json.favourite @ongoing_match.betting_info.favourite.try!(:name)
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
Use safe navigation (&.
) instead of try!
. Open
points.first.try!(:victor) == @ongoing_match.away_player &&
- Read upRead up
- Exclude checks
This cop converts usages of try!
to &.
. It can also be configured
to convert try
. It will convert code to use safe navigation if the
target Ruby version is set to 2.3+
Example:
# ConvertTry: false
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try!(:[], 0)
# good
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }
# ConvertTry: true
# bad
foo.try!(:bar)
foo.try!(:bar, baz)
foo.try!(:bar) { |e| e.baz }
foo.try(:bar)
foo.try(:bar, baz)
foo.try(:bar) { |e| e.baz }
# good
foo&.bar
foo&.bar(baz)
foo&.bar { |e| e.baz }