Commit 2ceed9ac authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'lint-uri-regex' into 'master'

Fix Lint/UriRegexp cop

See merge request gitlab-org/gitlab!41117
parents 84a0cc43 d6f70305
......@@ -113,14 +113,6 @@ Lint/UriEscapeUnescape:
- 'spec/lib/google_api/auth_spec.rb'
- 'spec/requests/api/files_spec.rb'
# Offense count: 3
# Cop supports --auto-correct.
Lint/UriRegexp:
Exclude:
- 'app/models/concerns/mentionable/reference_regexes.rb'
- 'app/services/projects/download_service.rb'
- 'lib/gitlab/ci/pipeline/chain/config/content/remote.rb'
# Offense count: 65
# Cop supports --auto-correct.
Migration/DepartmentName:
......
......@@ -30,7 +30,7 @@ module Mentionable
def self.external_pattern
strong_memoize(:external_pattern) do
issue_pattern = IssueTrackerService.reference_pattern
link_patterns = URI.regexp(%w(http https))
link_patterns = URI::DEFAULT_PARSER.make_regexp(%w(http https))
reference_pattern(link_patterns, issue_pattern)
end
end
......
......@@ -27,7 +27,7 @@ module Projects
end
def http?(url)
url =~ /\A#{URI.regexp(%w(http https))}\z/
url =~ /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/
end
def valid_domain?(url)
......
---
title: Fix Lint/UriRegexp cop
merge_request: 41117
author: Rajendra Kadam
type: fixed
......@@ -9,7 +9,7 @@ module Gitlab
class Remote < Source
def content
strong_memoize(:content) do
next unless ci_config_path =~ URI.regexp(%w[http https])
next unless ci_config_path =~ URI::DEFAULT_PARSER.make_regexp(%w[http https])
YAML.dump('include' => [{ 'remote' => ci_config_path }])
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment