Implements semantic validation to complement existing structural validation: Phase 1 & 2 Complete: - SemanticValidator: Main validator orchestrating sub-validators - SectionValidator: Enforces section classifications (required, recommended, optional, discouraged, improper) from x-markitect-sections - ContentValidator: Validates content patterns, forbidden patterns, and quality metrics (word counts, sentence counts) from x-markitect-content-control Features: - Pattern matching with regex for required/forbidden/discouraged patterns - Word count and sentence count validation - Detailed error reporting with severity levels (ERROR, WARNING) - Support for section alternatives (e.g., FLAGS vs OPTIONS) - Comprehensive test coverage (16 tests, 100% passing) Architecture: - Complements existing SchemaValidator (structural AST validation) - Clean separation: validators/ package for modular validators - Semantic validation focuses on x-markitect-* extensions - LinkValidator planned for Phase 3 (optional --check-links) Next: Phase 4 - CLI integration to enhance 'markitect validate' command Workplan: roadmap/20260106-semantic-document-validation/WORKPLAN.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
"""
|
|
Validators package for semantic document validation.
|
|
|
|
This package contains validators that check markdown documents against
|
|
x-markitect schema extensions (sections, content-control, link validation).
|
|
|
|
Validators:
|
|
- SectionValidator: Validates section presence based on classifications
|
|
- ContentValidator: Validates content patterns and quality metrics
|
|
- LinkValidator: Validates internal and external links
|
|
"""
|
|
|
|
from markitect.validators.section_validator import (
|
|
SectionValidator,
|
|
SectionValidationResult,
|
|
SectionIssue,
|
|
SectionMissing,
|
|
SectionImproper,
|
|
SectionDiscouraged,
|
|
)
|
|
|
|
from markitect.validators.content_validator import (
|
|
ContentValidator,
|
|
ContentValidationResult,
|
|
ContentIssue,
|
|
PatternMissing,
|
|
ForbiddenPattern,
|
|
DiscouragedPattern,
|
|
ContentTooShort,
|
|
ContentTooLong,
|
|
)
|
|
|
|
__all__ = [
|
|
# Section validator
|
|
'SectionValidator',
|
|
'SectionValidationResult',
|
|
'SectionIssue',
|
|
'SectionMissing',
|
|
'SectionImproper',
|
|
'SectionDiscouraged',
|
|
# Content validator
|
|
'ContentValidator',
|
|
'ContentValidationResult',
|
|
'ContentIssue',
|
|
'PatternMissing',
|
|
'ForbiddenPattern',
|
|
'DiscouragedPattern',
|
|
'ContentTooShort',
|
|
'ContentTooLong',
|
|
]
|