module HamlLint::Reporter::Utils

Formatting helpers for printing the default report format.

Public Instance Methods

pluralize(word, count: 1) click to toggle source

Pluralizes a word based on a count.

@param word [String] the word to pluralize @param count [Integer] the count of items @return [String]

# File lib/haml_lint/reporter/utils.rb, line 11
def pluralize(word, count: 1)
  if count.zero? || count > 1
    "#{count} #{word}s"
  else
    "#{count} #{word}"
  end
end
print_lint(lint) click to toggle source

Prints the lint with its location and severity.

@param lint [HamlLint::Lint] the lint to print @return [void]

print_location(lint) click to toggle source

Prints the location of a lint.

@param lint [HamlLint::Lint] the lint to print @return [void]

print_message(lint) click to toggle source

Prints the description of a lint.

@param lint [HamlLint::Lint] the lint to print @return [void]

print_summary(report) click to toggle source

Prints a summary of a report when summaries are enabled.

@param report [HamlLint::Report] the report to print @return [void]

print_summary_files(report) click to toggle source

Prints a summary of the number of files linted in a report.

@param report [HamlLint::Report] the report to print @return [void]

print_summary_lints(report) click to toggle source

Prints a summary of the number of lints found in a report.

@param report [HamlLint::Report] the report to print @return [void]

print_type(lint) click to toggle source

Prints the severity of a lint.

@param lint [HamlLint::Lint] the lint to print @return [void]