Commit d6f70305 authored by Rajendra Kadam's avatar Rajendra Kadam

Fix Lint/UriRegexp cop

This MR fixes the
Lint/UriRegexp cop and
adds changelog for the same

Add changelog
parent de6fba24
...@@ -113,14 +113,6 @@ Lint/UriEscapeUnescape: ...@@ -113,14 +113,6 @@ Lint/UriEscapeUnescape:
- 'spec/lib/google_api/auth_spec.rb' - 'spec/lib/google_api/auth_spec.rb'
- 'spec/requests/api/files_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 # Offense count: 65
# Cop supports --auto-correct. # Cop supports --auto-correct.
Migration/DepartmentName: Migration/DepartmentName:
......
...@@ -30,7 +30,7 @@ module Mentionable ...@@ -30,7 +30,7 @@ module Mentionable
def self.external_pattern def self.external_pattern
strong_memoize(:external_pattern) do strong_memoize(:external_pattern) do
issue_pattern = IssueTrackerService.reference_pattern 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) reference_pattern(link_patterns, issue_pattern)
end end
end end
......
...@@ -27,7 +27,7 @@ module Projects ...@@ -27,7 +27,7 @@ module Projects
end end
def http?(url) def http?(url)
url =~ /\A#{URI.regexp(%w(http https))}\z/ url =~ /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/
end end
def valid_domain?(url) def valid_domain?(url)
......
---
title: Fix Lint/UriRegexp cop
merge_request: 41117
author: Rajendra Kadam
type: fixed
...@@ -9,7 +9,7 @@ module Gitlab ...@@ -9,7 +9,7 @@ module Gitlab
class Remote < Source class Remote < Source
def content def content
strong_memoize(:content) do 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 }]) YAML.dump('include' => [{ 'remote' => ci_config_path }])
end 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