diff --git a/.rubocop.yml b/.rubocop.yml index 51d21cc87..0ca61a12b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -264,8 +264,6 @@ Lint/ShadowingOuterLocalVariable: Enabled: false Style/InfiniteLoop: Enabled: false -Lint/AmbiguousRegexpLiteral: - Enabled: false Lint/Eval: Enabled: false Style/ModuleFunction: diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 491c37db9..a67d48f34 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -38,7 +38,7 @@ class TicketsController < ApplicationController # create tags if given if params[:tags] && !params[:tags].empty? - tags = params[:tags].split /,/ + tags = params[:tags].split(/,/) tags.each {|tag| Tag.tag_add( object: 'Ticket', diff --git a/app/models/ticket/subject.rb b/app/models/ticket/subject.rb index 7a7f61163..15d19dcc2 100644 --- a/app/models/ticket/subject.rb +++ b/app/models/ticket/subject.rb @@ -56,17 +56,17 @@ returns ticket_subject_size = Setting.get('ticket_subject_size') # remove all possible ticket hook formats with [] - subject = subject.gsub /\[#{ticket_hook}: #{self.number}\](\s+?|)/, '' - subject = subject.gsub /\[#{ticket_hook}:#{self.number}\](\s+?|)/, '' - subject = subject.gsub /\[#{ticket_hook}#{ticket_hook_divider}#{self.number}\](\s+?|)/, '' + subject = subject.gsub(/\[#{ticket_hook}: #{self.number}\](\s+?|)/, '') + subject = subject.gsub(/\[#{ticket_hook}:#{self.number}\](\s+?|)/, '') + subject = subject.gsub(/\[#{ticket_hook}#{ticket_hook_divider}#{self.number}\](\s+?|)/, '') # remove all possible ticket hook formats without [] - subject = subject.gsub /#{ticket_hook}: #{self.number}(\s+?|)/, '' - subject = subject.gsub /#{ticket_hook}:#{self.number}(\s+?|)/, '' - subject = subject.gsub /#{ticket_hook}#{ticket_hook_divider}#{self.number}(\s+?|)/, '' + subject = subject.gsub(/#{ticket_hook}: #{self.number}(\s+?|)/, '') + subject = subject.gsub(/#{ticket_hook}:#{self.number}(\s+?|)/, '') + subject = subject.gsub(/#{ticket_hook}#{ticket_hook_divider}#{self.number}(\s+?|)/, '') # remove leading "..:\s" and "..[\d+]:\s" e. g. "Re: " or "Re[5]: " - subject = subject.gsub /^(..(\[\d+\])?:\s)+/, '' + subject = subject.gsub(/^(..(\[\d+\])?:\s)+/, '') # resize subject based on config if subject.length > ticket_subject_size.to_i