Class: DocGuard::AssessDocumentationRelevance::Subprocesses::ReportAssessment

Inherits:
Object
  • Object
show all
Defined in:
lib/doc_guard/assess_documentation_relevance/subprocesses/report_assessment.rb

Overview

Reports the result of the documentation relevance assessment.

Class Method Summary collapse

Class Method Details

.run(assessment: {}) ⇒ void

This method returns an undefined value.

Outputs the result and exits if documentation is outdated.

Parameters:

  • assessment (Hash{Symbol => Object}) (defaults to: {})
    • :relevant [Boolean] Whether documentation is outdated.

    • :mismatches [Hash<String, Array<String>>] Mapping of documentation files to lists of tracked source file paths.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/doc_guard/assess_documentation_relevance/subprocesses/report_assessment.rb', line 14

def self.run(assessment: {})
  if assessment[:relevant]
    warn "‼️ Documentation may be outdated!"

    assessment[:mismatches].each do |documentation_file, changed_files|
      warn "\n📄 #{documentation_file}"
      changed_files.each do |file|
        warn "- #{file}"
      end
    end

    exit(1)
  else
    puts "✅ Documentation is up to date."
  end
end