summaryrefslogtreecommitdiff
path: root/app/controllers/projects/ci/lints_controller.rb
blob: 7e900fc60516a5395de23919f05b71f7b1112309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

class Projects::Ci::LintsController < Projects::ApplicationController
  before_action :authorize_create_pipeline!
  before_action do
    push_frontend_feature_flag(:ci_lint_vue, project)
  end

  feature_category :pipeline_authoring

  def show
  end

  def create
    @content = params[:content]
    @dry_run = params[:dry_run]

    @result = Gitlab::Ci::Lint
      .new(project: @project, current_user: current_user)
      .validate(@content, dry_run: @dry_run)

    respond_to do |format|
      format.html { render :show }
      format.json do
        render json: ::Ci::Lint::ResultSerializer.new.represent(@result)
      end
    end
  end
end