Class: Yamlint::Output::Standard

Inherits:
Base
  • Object
show all
Defined in:
lib/yamlint/output/standard.rb

Instance Method Summary collapse

Instance Method Details

#format(filepath, problems) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/yamlint/output/standard.rb', line 6

def format(filepath, problems)
  return '' if problems.empty?

  lines = [filepath]
  problems.each do |problem|
    lines << "  #{problem.line}:#{problem.column}      #{problem.level}   #{problem.message}  (#{problem.rule})"
  end
  lines.join("\n")
end

#format_summary(total_files, total_problems) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/yamlint/output/standard.rb', line 16

def format_summary(total_files, total_problems)
  if total_problems.zero?
    "#{total_files} file(s) checked, no problems found"
  else
    "#{total_files} file(s) checked, #{total_problems} problem(s) found"
  end
end