]> source.dussan.org Git - redmine.git/commitdiff
Code cleanup: RuboCop: Fix Performance/RedundantMatch and Rails/DynamicFindBy in...
authorGo MAEDA <maeda@farend.jp>
Wed, 11 Sep 2019 08:08:38 +0000 (08:08 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 11 Sep 2019 08:08:38 +0000 (08:08 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@18451 e93f8b46-1217-0410-a6f0-8f06a7374b81

.rubocop_todo.yml
app/controllers/auto_completes_controller.rb

index 6d965654dd1f2060d5dfa79ffdf68f6918f19dba..a2d77a5476253493a60d57a70ea4a9aab082a423 100644 (file)
@@ -817,7 +817,6 @@ Performance/RedundantBlockCall:
 # Cop supports --auto-correct.
 Performance/RedundantMatch:
   Exclude:
-    - 'app/controllers/auto_completes_controller.rb'
     - 'app/models/issue_relation.rb'
     - 'lib/redmine/wiki_formatting/textile/formatter.rb'
     - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
index e83374c9bb3438e50459bf800f60b6f7aca73677..3368853495514bdb1c296db80497515a3f8015d3 100644 (file)
@@ -30,8 +30,8 @@ class AutoCompletesController < ApplicationController
     scope = scope.open(status == 'o') if status.present?
     scope = scope.where.not(:id => issue_id.to_i) if issue_id.present?
     if q.present?
-      if q.match(/\A#?(\d+)\z/)
-        issues << scope.find_by_id($1.to_i)
+      if q =~ /\A#?(\d+)\z/
+        issues << scope.find_by(:id => $1.to_i)
       end
       issues += scope.like(q).order(:id => :desc).limit(10).to_a
       issues.compact!