summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKatarzyna Kobierska <kkobierska@gmail.com>2016-08-26 12:49:59 +0200
committerKatarzyna Kobierska <kkobierska@gmail.com>2016-09-07 12:10:49 +0200
commitbbba62fa51419b14be4f39873afdd45b5b248764 (patch)
treec10b2c727c4d392fb0956bb1d61b6cfe36b6eaff /lib
parentcfa18dab86d5408814f4c6083b843205c3d1599e (diff)
downloadgitlab-ce-bbba62fa51419b14be4f39873afdd45b5b248764.tar.gz
Fix errors and grammar
Diffstat (limited to 'lib')
-rw-r--r--lib/api/lint.rb23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/api/lint.rb b/lib/api/lint.rb
index 2757b800af0..ff35e948e0c 100644
--- a/lib/api/lint.rb
+++ b/lib/api/lint.rb
@@ -9,23 +9,20 @@ module API
post do
response = {
status: '',
- errors: [],
+ error: [],
jobs: []
}
- if !Ci::GitlabCiYamlProcessor.errors(@content).nil?
- status 200
- response[:errors].push(Ci::GitlabCiYamlProcessor.errors(@content))
- response[:status] = 'invalid'
-
- response
- end
+ if Ci::GitlabCiYamlProcessor.errors(params[:content]).nil?
+ config_processor = Ci::GitlabCiYamlProcessor.new(params[:content])
- config_processor = Ci::GitlabCiYamlProcessor.new(params[:content])
-
- config_processor.builds.each do |build|
- response[:jobs].push("#{build[:name]}")
- response[:status] = 'valid'
+ config_processor.builds.each do |build|
+ response[:jobs].push("#{build[:name]}")
+ response[:status] = 'valid'
+ end
+ else
+ response[:error].push(Ci::GitlabCiYamlProcessor.errors(params[:content]))
+ response[:status] = 'invalid'
end
status 200