Skip to content

Commit

Permalink
Enable rubocop Performance/RedundantMatch cop & fix issues
Browse files Browse the repository at this point in the history
Some cop offenses have been stashed into rubocop_todo.yml for now
  • Loading branch information
bertocq committed Feb 10, 2018
1 parent 57743df commit 3f91e92
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -85,6 +85,9 @@ Performance/RangeInclude:
Performance/RedundantBlockCall:
Enabled: true

Performance/RedundantMatch:
Enabled: true

Performance/RedundantMerge:
Enabled: true

Expand Down
9 changes: 8 additions & 1 deletion .rubocop_todo.yml
@@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/embed_videos_helper.rb
Expand Up @@ -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

Expand Down

0 comments on commit 3f91e92

Please sign in to comment.