Class: WayOfWorking::DecisionRecord::Madr::GithubAuditRule

Inherits:
Audit::Github::Rules::Base show all
Defined in:
lib/way_of_working/decision_record/madr/github_audit_rule.rb

Overview

This rule checks for the MADR Decision Record template.

Constant Summary collapse

ADR_TEMPLATE_PATH =
'docs/decisions/adr-template.md'
DECISION_ZERO_PATH =
'docs/decisions/0000-use-markdown-any-decision-records.md'
WOW_DOCUMENTATION_PATH =
'docs/way_of_working/decision-records.md'

Instance Attribute Summary

Attributes inherited from Audit::Github::Rules::Base

#errors, #fix, #name, #rulesets, #warnings

Instance Method Summary collapse

Methods inherited from Audit::Github::Rules::Base

#initialize, source_root, #status, tags, #tags

Constructor Details

This class inherits a constructor from WayOfWorking::Audit::Github::Rules::Base

Instance Method Details

#validateObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/way_of_working/decision_record/madr/github_audit_rule.rb', line 17

def validate
  @errors << 'No MADR Decision Record template found' unless repo_file_contains?(
    ADR_TEMPLATE_PATH, '## Context and Problem Statement'
  )

  unless repo_file_contains_source_file?(WOW_DOCUMENTATION_PATH)
    @errors << 'Stale or missing documentation for using MADR Decision Records'
  end

  return if repo_file_contains_source_file?(DECISION_ZERO_PATH)

  @errors << 'No 0000-use-markdown-any-decision-records.md Decision Record found'
end