diff options
author | Leandro Camargo <leandroico@gmail.com> | 2016-12-05 02:00:47 -0200 |
---|---|---|
committer | Leandro Camargo <leandroico@gmail.com> | 2017-01-25 01:07:44 -0200 |
commit | 6323cd7203dbf1850e7939e81db4b1a9c6cf6d76 (patch) | |
tree | ca9a9450c85337fcaab7c9ecc83d92903826d06e /lib | |
parent | f1e920ed86133bfea0abfc66ca44282813822073 (diff) | |
download | gitlab-ce-6323cd7203dbf1850e7939e81db4b1a9c6cf6d76.tar.gz |
Comply to more requirements and requests made in the code review
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/config/entry/coverage.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/legacy_validation_helpers.rb | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/gitlab/ci/config/entry/coverage.rb b/lib/gitlab/ci/config/entry/coverage.rb index aa738fcfd11..706bfc882de 100644 --- a/lib/gitlab/ci/config/entry/coverage.rb +++ b/lib/gitlab/ci/config/entry/coverage.rb @@ -13,7 +13,7 @@ module Gitlab end def value - if @config.start_with?('/') && @config.end_with?('/') + if @config.first == '/' && @config.last == '/' @config[1...-1] else @config diff --git a/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb b/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb index d8e74b15712..9b9a0a8125a 100644 --- a/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb +++ b/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb @@ -29,8 +29,7 @@ module Gitlab end def validate_regexp(value) - Regexp.new(value) - true + !value.nil? && Regexp.new(value.to_s) && true rescue RegexpError, TypeError false end @@ -39,7 +38,7 @@ module Gitlab return true if value.is_a?(Symbol) return false unless value.is_a?(String) - if value.start_with?('/') && value.end_with?('/') + if value.first == '/' && value.last == '/' validate_regexp(value[1...-1]) else true |