Enable rubocop Performance/RedundantMatch cop & fix issues

Some cop offenses have been stashed into rubocop_todo.yml for now
This commit is contained in:
Bertocq
2018-02-10 21:26:02 +01:00
parent 57743df197
commit 3f91e920f6
3 changed files with 13 additions and 3 deletions

View File

@@ -85,6 +85,9 @@ Performance/RangeInclude:
Performance/RedundantBlockCall:
Enabled: true
Performance/RedundantMatch:
Enabled: true
Performance/RedundantMerge:
Enabled: true

View File

@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-02-10 21:08:01 +0100 using RuboCop version 0.52.1.
# on 2018-02-10 21:25:09 +0100 using RuboCop version 0.52.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -23,6 +23,13 @@ Layout/IndentationConsistency:
Metrics/LineLength:
Max: 248
# Offense count: 4
# Cop supports --auto-correct.
Performance/RedundantMatch:
Exclude:
- 'app/controllers/valuation/budget_investments_controller.rb'
- 'app/controllers/valuation/spending_proposals_controller.rb'
# Offense count: 11
RSpec/DescribeClass:
Exclude:

View File

@@ -6,9 +6,9 @@ module EmbedVideosHelper
def embedded_video_code
link = @proposal.video_url
title = t('proposals.show.embed_video_title', proposal: @proposal.title)
if link.match(/vimeo.*/)
if link =~ /vimeo.*/
server = "Vimeo"
elsif link.match(/youtu*.*/)
elsif link =~ /youtu*.*/
server = "YouTube"
end