Commit b1ecef3a authored by Phil Hughes's avatar Phil Hughes

Merge branch 'ci-lint-error-formatting' into 'master'

CI Lint Error Formatting

See merge request gitlab-org/gitlab!21608
parents cc087b3f 734753a8
...@@ -10,8 +10,8 @@ class Projects::Ci::LintsController < Projects::ApplicationController ...@@ -10,8 +10,8 @@ class Projects::Ci::LintsController < Projects::ApplicationController
@content = params[:content] @content = params[:content]
result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options) result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options)
@error = result.errors.join(', ') @status = result.valid?
@status = result.valid? @errors = result.errors
if result.valid? if result.valid?
@config_processor = result.content @config_processor = result.content
......
- if @status - if @status
%p .bs-callout.bs-callout-success
%b= _("Status:") %p
= _("syntax is correct") %b= _("Status:")
%i.fa.fa-ok.correct-syntax = _("syntax is correct")
.table-holder .table-holder
%table.table.table-bordered %table.table.table-bordered
...@@ -40,9 +40,10 @@ ...@@ -40,9 +40,10 @@
%b= _("Allowed to fail") %b= _("Allowed to fail")
- else - else
%p .bs-callout.bs-callout-danger
%b= _("Status:") %p
= _("syntax is incorrect") %b= _("Status:")
%i.fa.fa-remove.incorrect-syntax = _("syntax is incorrect")
%b= _("Error:") %pre
= @error - @errors.each do |message|
%p= message
---
title: Add JSON error context to extends error in CI lint
merge_request: 30066
author:
type: changed
...@@ -7278,9 +7278,6 @@ msgstr "" ...@@ -7278,9 +7278,6 @@ msgstr ""
msgid "Error with Akismet. Please check the logs for more info." msgid "Error with Akismet. Please check the logs for more info."
msgstr "" msgstr ""
msgid "Error:"
msgstr ""
msgid "ErrorTracking|Active" msgid "ErrorTracking|Active"
msgstr "" msgstr ""
......
...@@ -103,7 +103,7 @@ describe Projects::Ci::LintsController do ...@@ -103,7 +103,7 @@ describe Projects::Ci::LintsController do
end end
it 'assigns errors' do it 'assigns errors' do
expect(assigns[:error]).to eq('root config contains unknown keys: rubocop') expect(assigns[:errors]).to eq(['root config contains unknown keys: rubocop'])
end end
end end
......
...@@ -75,6 +75,7 @@ describe 'projects/ci/lints/show' do ...@@ -75,6 +75,7 @@ describe 'projects/ci/lints/show' do
it 'shows the correct values' do it 'shows the correct values' do
render render
expect(rendered).to have_content('Status: syntax is correct')
expect(rendered).to have_content('Tag list: dotnet') expect(rendered).to have_content('Tag list: dotnet')
expect(rendered).to have_content('Only policy: refs, test@dude/repo') expect(rendered).to have_content('Only policy: refs, test@dude/repo')
expect(rendered).to have_content('Except policy: refs, deploy') expect(rendered).to have_content('Except policy: refs, deploy')
...@@ -87,14 +88,14 @@ describe 'projects/ci/lints/show' do ...@@ -87,14 +88,14 @@ describe 'projects/ci/lints/show' do
before do before do
assign(:project, project) assign(:project, project)
assign(:status, false) assign(:status, false)
assign(:error, 'Undefined error') assign(:errors, ['Undefined error'])
end end
it 'shows error message' do it 'shows error message' do
render render
expect(rendered).to have_content('Status: syntax is incorrect') expect(rendered).to have_content('Status: syntax is incorrect')
expect(rendered).to have_content('Error: Undefined error') expect(rendered).to have_content('Undefined error')
expect(rendered).not_to have_content('Tag list:') expect(rendered).not_to have_content('Tag list:')
end end
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