Class: Rules::MissingTimeouts

Inherits:
Base
  • Object
show all
Defined in:
lib/rules/missing_timeouts.rb

Instance Method Summary collapse

Instance Method Details

#check(workflow) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rules/missing_timeouts.rb', line 7

def check(workflow)
    findings = []

    workflow.jobs.each do |job_id, job|
        next if job.key?("timeout-minutes")

        line = workflow.line_of(/^\s+#{Regexp.escape(job_id)}:/)
        findings << finding(workflow,
            line: line || 0,
            code: "#{job_id}:",
            message: "Job '#{job_id}' has no timeout-minutes — default is 360 minutes (6 hours)",
            fix: "Add timeout-minutes: appropriate for the job type (5-30 min)"
        )
    end

    findings
end

#descriptionObject



4
# File 'lib/rules/missing_timeouts.rb', line 4

def description = "Job without timeout-minutes"

#nameObject



3
# File 'lib/rules/missing_timeouts.rb', line 3

def name = "missing-timeouts"

#severityObject



5
# File 'lib/rules/missing_timeouts.rb', line 5

def severity = :medium