RuboCop: Style/RedundantRegexpCharacterClass

auto-corrected

Change-Id: I0dfcfd76c5f3fbdc6a91ee0a961f6194a86688b0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278638
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-11-17 14:02:44 -07:00
parent fe75025e1d
commit 872e5458af
6 changed files with 7 additions and 5 deletions

View File

@ -240,6 +240,8 @@ Style/RedundantFreeze:
Severity: error
Style/RedundantParentheses:
Severity: error
Style/RedundantRegexpCharacterClass:
Severity: error
Style/RedundantRegexpEscape:
Severity: error
Style/RedundantReturn:

View File

@ -803,7 +803,7 @@ class ContextExternalTool < ActiveRecord::Base
url = ContextExternalTool.standardize_url(url)
host = Addressable::URI.parse(url).normalize.host rescue nil
port = Addressable::URI.parse(url).normalize.port rescue nil
d = domain.downcase.gsub(%r{http[s]?://}, '')
d = domain.downcase.gsub(%r{https?://}, '')
!!(host && ('.' + host + (port ? ":#{port}" : '')).match(/\.#{d}\z/))
end

View File

@ -35,7 +35,7 @@ class EportfolioCategory < ActiveRecord::Base
def infer_unique_slug
categories = self.eportfolio.eportfolio_categories
self.name ||= t(:default_section, "Section Name")
self.slug = self.name.gsub(/[\s]+/, "_").gsub(/[^\w\d]/, "")
self.slug = self.name.gsub(/\s+/, "_").gsub(/[^\w\d]/, "")
categories = categories.where("id<>?", self) unless self.new_record?
match_cnt = categories.where(:slug => self.slug).count
if match_cnt > 0

View File

@ -141,7 +141,7 @@ class EportfolioEntry < ActiveRecord::Base
def infer_unique_slug
pages = self.eportfolio_category.eportfolio_entries rescue []
self.name ||= t(:default_name, "Page Name")
self.slug = self.name.gsub(/[\s]+/, "_").gsub(/[^\w\d]/, "")
self.slug = self.name.gsub(/\s+/, "_").gsub(/[^\w\d]/, "")
pages = pages.where("id<>?", self) unless self.new_record?
match_cnt = pages.where(:slug => self.slug).count
if match_cnt > 0

View File

@ -40,7 +40,7 @@ class MediaTrack < ActiveRecord::Base
if self.content.exclude?('WEBVTT') && (self.content_changed? || self.read_attribute(:webvtt_content).nil?)
srt_content = self.content.dup
srt_content.gsub!(/(:|^)(\d)(,|:)/, '\10\2\3')
srt_content.gsub!(/([0-9]{2}:[0-9]{2}:[0-9]{2})([,])([0-9]{3})/, '\1.\3')
srt_content.gsub!(/([0-9]{2}:[0-9]{2}:[0-9]{2})(,)([0-9]{3})/, '\1.\3')
srt_content.gsub!("\r\n", "\n")
self.webvtt_content = "WEBVTT\n\n#{srt_content}".strip
end

View File

@ -126,7 +126,7 @@ class ApiRouteSet
# .json -- but see the api docs for info on sending hex-encoded sis ids,
# which allows any string.
ID_REGEX = %r{(?:[^/?.]|\.(?!json(?:\z|[/?])))+}.freeze
ID_PARAM = /^:(id|[\w]+_id)$/.freeze
ID_PARAM = /^:(id|\w+_id)$/.freeze
def self.prefix
"/api/v1"