Class: Textus::Doctor::Check::StaleReviewedStamp

Inherits:
Textus::Doctor::Check show all
Defined in:
lib/textus/doctor/check/stale_reviewed_stamp.rb

Overview

Warns when a knowledge-lane doc’s ‘reviewed YYYY-MM (vX.Y)` stamp is more than MINOR_THRESHOLD minor versions behind Textus::VERSION. The stamp is the human staleness signal declared in docs conventions (knowledge.docs-index); this check makes it machine-enforced.

Constant Summary collapse

STAMP_RE =
/\*\*reviewed\*\*\s+\d{4}-\d{2}\s+\(v(\d+\.\d+(?:\.\d+)?)\)/
MINOR_THRESHOLD =
5

Instance Method Summary collapse

Methods inherited from Textus::Doctor::Check

#initialize, name_key

Constructor Details

This class inherits a constructor from Textus::Doctor::Check

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/textus/doctor/check/stale_reviewed_stamp.rb', line 12

def call
  current_minor = parse_minor(Textus::VERSION)
  issues = []

  manifest.resolver.enumerate.each do |row|
    next unless row[:key].to_s.start_with?("knowledge.")
    next unless row[:path] && File.file?(row[:path])

    body = File.read(row[:path])
    m = body.match(STAMP_RE)
    next unless m

    reviewed_minor = parse_minor(m[1])
    behind = current_minor - reviewed_minor
    next unless behind > MINOR_THRESHOLD

    issues << stale_issue(row[:key], m[1], behind)
  end

  issues
end