diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-18 15:19:24 -0400 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-18 15:19:24 -0400 |
commit | 3f66f4470a7399a5079de04b8b2506edc159b90a (patch) | |
tree | 2731cf01494a7c35bd34e6bbef1053013989d59e /lib/ci | |
parent | 2665af68a5a151bc967797d5eb1e3a1c1041f336 (diff) | |
download | gitlab-ce-3f66f4470a7399a5079de04b8b2506edc159b90a.tar.gz |
Make rubocop happymake-before-after-overridable
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 88d6ce01b03..ff9887cba1e 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -160,6 +160,7 @@ module Ci validate_job_name!(name) validate_job_keys!(name, job) validate_job_types!(name, job) + validate_job_script!(name, job) validate_job_stage!(name, job) if job[:stage] validate_job_variables!(name, job) if job[:variables] @@ -183,18 +184,6 @@ module Ci end def validate_job_types!(name, job) - if !validate_string(job[:script]) && !validate_array_of_strings(job[:script]) - raise ValidationError, "#{name} job: script should be a string or an array of a strings" - end - - if job[:before_script] && !validate_array_of_strings(job[:before_script]) - raise ValidationError, "#{name} job: before_script should be an array of strings" - end - - if job[:after_script] && !validate_array_of_strings(job[:after_script]) - raise ValidationError, "#{name} job: after_script should be an array of strings" - end - if job[:image] && !validate_string(job[:image]) raise ValidationError, "#{name} job: image should be a string" end @@ -224,6 +213,20 @@ module Ci end end + def validate_job_script!(name, job) + if !validate_string(job[:script]) && !validate_array_of_strings(job[:script]) + raise ValidationError, "#{name} job: script should be a string or an array of a strings" + end + + if job[:before_script] && !validate_array_of_strings(job[:before_script]) + raise ValidationError, "#{name} job: before_script should be an array of strings" + end + + if job[:after_script] && !validate_array_of_strings(job[:after_script]) + raise ValidationError, "#{name} job: after_script should be an array of strings" + end + end + def validate_job_stage!(name, job) unless job[:stage].is_a?(String) && job[:stage].in?(stages) raise ValidationError, "#{name} job: stage parameter should be #{stages.join(", ")}" |