Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/dependency_linker')
-rw-r--r--lib/gitlab/dependency_linker/base_linker.rb4
-rw-r--r--lib/gitlab/dependency_linker/cargo_toml_linker.rb6
-rw-r--r--lib/gitlab/dependency_linker/composer_json_linker.rb2
-rw-r--r--lib/gitlab/dependency_linker/godeps_json_linker.rb6
-rw-r--r--lib/gitlab/dependency_linker/json_linker.rb6
-rw-r--r--lib/gitlab/dependency_linker/podspec_linker.rb4
6 files changed, 18 insertions, 10 deletions
diff --git a/lib/gitlab/dependency_linker/base_linker.rb b/lib/gitlab/dependency_linker/base_linker.rb
index 76855f2950d..6d114de8ae8 100644
--- a/lib/gitlab/dependency_linker/base_linker.rb
+++ b/lib/gitlab/dependency_linker/base_linker.rb
@@ -34,9 +34,9 @@ module Gitlab
return if external_ref =~ GIT_INVALID_URL_REGEX
case external_ref
- when /\A#{URL_REGEX}\z/
+ when /\A#{URL_REGEX}\z/o
external_ref
- when /\A#{REPO_REGEX}\z/
+ when /\A#{REPO_REGEX}\z/o
github_url(external_ref)
else
package_url(name)
diff --git a/lib/gitlab/dependency_linker/cargo_toml_linker.rb b/lib/gitlab/dependency_linker/cargo_toml_linker.rb
index 57e0a5f4699..cba4319ce83 100644
--- a/lib/gitlab/dependency_linker/cargo_toml_linker.rb
+++ b/lib/gitlab/dependency_linker/cargo_toml_linker.rb
@@ -39,7 +39,11 @@ module Gitlab
end
def toml
- @toml ||= TomlRB.parse(plain_text) rescue nil
+ @toml ||= begin
+ TomlRB.parse(plain_text)
+ rescue StandardError
+ nil
+ end
end
end
end
diff --git a/lib/gitlab/dependency_linker/composer_json_linker.rb b/lib/gitlab/dependency_linker/composer_json_linker.rb
index 4b8862b31ee..965ed8bb95e 100644
--- a/lib/gitlab/dependency_linker/composer_json_linker.rb
+++ b/lib/gitlab/dependency_linker/composer_json_linker.rb
@@ -13,7 +13,7 @@ module Gitlab
end
def package_url(name)
- "https://packagist.org/packages/#{name}" if name =~ /\A#{REPO_REGEX}\z/
+ "https://packagist.org/packages/#{name}" if name =~ /\A#{REPO_REGEX}\z/o
end
end
end
diff --git a/lib/gitlab/dependency_linker/godeps_json_linker.rb b/lib/gitlab/dependency_linker/godeps_json_linker.rb
index 9166e9091ac..049a807b760 100644
--- a/lib/gitlab/dependency_linker/godeps_json_linker.rb
+++ b/lib/gitlab/dependency_linker/godeps_json_linker.rb
@@ -12,10 +12,10 @@ module Gitlab
def link_dependencies
link_json('ImportPath') do |path|
case path
- when %r{\A(?<repo>github\.com/#{REPO_REGEX})/(?<path>.+)\z}
+ when %r{\A(?<repo>github\.com/#{REPO_REGEX})/(?<path>.+)\z}o
"https://#{$~[:repo]}/tree/master/#{$~[:path]}"
- when %r{\A(?<repo>gitlab\.com/#{NESTED_REPO_REGEX})\.git/(?<path>.+)\z},
- %r{\A(?<repo>gitlab\.com/#{REPO_REGEX})/(?<path>.+)\z}
+ when %r{\A(?<repo>gitlab\.com/#{NESTED_REPO_REGEX})\.git/(?<path>.+)\z}o,
+ %r{\A(?<repo>gitlab\.com/#{REPO_REGEX})/(?<path>.+)\z}o
"https://#{$~[:repo]}/-/tree/master/#{$~[:path]}"
when /\Agolang\.org/
diff --git a/lib/gitlab/dependency_linker/json_linker.rb b/lib/gitlab/dependency_linker/json_linker.rb
index 86dc7efb0d9..15c17132283 100644
--- a/lib/gitlab/dependency_linker/json_linker.rb
+++ b/lib/gitlab/dependency_linker/json_linker.rb
@@ -39,7 +39,11 @@ module Gitlab
end
def json
- @json ||= Gitlab::Json.parse(plain_text) rescue nil
+ @json ||= begin
+ Gitlab::Json.parse(plain_text)
+ rescue StandardError
+ nil
+ end
end
end
end
diff --git a/lib/gitlab/dependency_linker/podspec_linker.rb b/lib/gitlab/dependency_linker/podspec_linker.rb
index 14abd3999c4..f6da17efff4 100644
--- a/lib/gitlab/dependency_linker/podspec_linker.rb
+++ b/lib/gitlab/dependency_linker/podspec_linker.rb
@@ -14,10 +14,10 @@ module Gitlab
def link_dependencies
link_method_call('homepage', URL_REGEX, &:itself)
- link_regex(/(git:|:git\s*=>)\s*['"](?<name>#{URL_REGEX})['"]/, &:itself)
+ link_regex(/(git:|:git\s*=>)\s*['"](?<name>#{URL_REGEX})['"]/o, &:itself)
link_method_call('license', &method(:license_url))
- link_regex(/license\s*=\s*\{\s*(type:|:type\s*=>)\s*#{STRING_REGEX}/, &method(:license_url))
+ link_regex(/license\s*=\s*\{\s*(type:|:type\s*=>)\s*#{STRING_REGEX}/o, &method(:license_url))
link_method_call('dependency', &method(:package_url))
end