Class: Gitlab::Ci::Lint

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/lint.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(project:, current_user:) ⇒ Lint

Returns a new instance of Lint.


20
21
22
23
# File 'lib/gitlab/ci/lint.rb', line 20

def initialize(project:, current_user:)
  @project = project
  @current_user = current_user
end

Instance Method Details

#validate(content, dry_run: false) ⇒ Object


25
26
27
28
29
30
31
# File 'lib/gitlab/ci/lint.rb', line 25

def validate(content, dry_run: false)
  if dry_run && Gitlab::Ci::Features.lint_creates_pipeline_with_dry_run?(@project)
    simulate_pipeline_creation(content)
  else
    static_validation(content)
  end
end