Fix UriDefaultParser cop

This commit is contained in:
Semyon Pupkov 2018-09-21 11:55:02 +05:00
parent 2d0839e542
commit 869d8e814e
2 changed files with 1 additions and 6 deletions

View File

@ -130,11 +130,6 @@ Naming/HeredocDelimiterCase:
Naming/HeredocDelimiterNaming:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Performance/UriDefaultParser:
Exclude:
- 'lib/gitlab/url_sanitizer.rb'
# Offense count: 3821
# Configuration parameters: Prefixes.

View File

@ -3,7 +3,7 @@ module Gitlab
ALLOWED_SCHEMES = %w[http https ssh git].freeze
def self.sanitize(content)
regexp = URI::Parser.new.make_regexp(ALLOWED_SCHEMES)
regexp = URI::DEFAULT_PARSER.make_regexp(ALLOWED_SCHEMES)
content.gsub(regexp) { |url| new(url).masked_url }
rescue Addressable::URI::InvalidURIError