This folder contains the complete documentation for the linter auto-fix feature implementation.
The main feature specification including:
- Overview and goals
- Feature description with
--fixflag usage - Decision rationale (why Option 3 was chosen)
- Linter auto-fix support matrix
- Expected behavior and output format using tracing
- Safety considerations
- Definition of done
- Testing strategy
Clarifying questions that need to be answered before implementation:
- Linter scope and tools
- Fix behavior (what gets fixed)
- Output verbosity using tracing
- Exit code behavior
- Git integration
- Error handling
- Testing requirements
- Documentation updates
- Backward compatibility
- Timeline and priority
Current Phase: Specification Complete
Next Steps:
- ✅ Create feature specification
- ✅ Create questions document
- ✅ Answer clarifying questions in
questions.md - ✅ Update specification based on answers
- ⏳ Create detailed implementation plan
- ⏳ Review implementation plan
- ⏳ Commit documentation
- ⏳ Begin implementation
Add a --fix flag to the linter binary that:
- Automatically fixes issues for linters that support auto-fix
- Uses yamlfmt for YAML formatting (not prettier)
- Uses tracing crate with minimal verbosity (show only "Fixed N files" summaries)
- Shows only remaining errors after auto-fix
- Allows developers to use git to see what changed
- Auto-installs missing tools (matches current linter behavior)
- Maintains backward compatibility (no
--fix= current behavior) - Incremental implementation: One linter at a time for easier testing and commits
Usage:
# Check only (current behavior)
cargo run --bin linter all
# Fix and check
cargo run --bin linter all --fix
# Individual linters
cargo run --bin linter markdown --fixBased on answers in questions.md, the following key decisions were made:
-
YAML Tool: Use yamlfmt (not prettier) for YAML formatting
- Reason: More focused tool, simpler to integrate
-
Fix Scope: Fix the same files that current linter checks (Option B)
- No expansion to additional file types
- Consistent with existing linter behavior
-
Output Verbosity: Minimal - show only "Fixed N files" summaries
- Keep output clean and focused
- Users can see detailed changes via
git diff - Only display errors that still need attention
-
Error Handling: Auto-install missing tools (Option D)
- Matches current linter behavior
- Seamless developer experience
- Logs installation for transparency
-
Testing Strategy: Unit + Integration + E2E + Manual
- Comprehensive but focused
- No property-based testing needed for initial version
-
Implementation: Incremental - one linter at a time
- Easier to review, test, and commit
- Reduces risk and complexity
- Can deploy partial functionality
-
Git Integration: Don't auto-stage changes
- Let git track changes naturally
- Developers review with
git diffbefore committing