Contributing¶
Thank you for your interest in contributing to linthis!
Getting Started¶
Prerequisites¶
- Rust 1.75+ (stable)
- Cargo
Clone and Build¶
git clone https://github.com/zhlinh/linthis.git
cd linthis
cargo build
Run Tests¶
cargo test
Run Clippy¶
cargo clippy
Development Workflow¶
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Run tests:
cargo test - Run clippy:
cargo clippy - Commit your changes:
git commit -m "feat: add my feature" - Push to your fork:
git push origin feature/my-feature - Open a Pull Request
Code Style¶
- Follow Rust standard conventions
- Use
rustfmtfor formatting - Use
clippyfor linting - Write tests for new features
- Document public APIs
Commit Messages¶
We follow Conventional Commits:
feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Test changeschore:- Build/tooling changes
Examples:
feat(python): add support for mypy
fix(cli): handle empty file list correctly
docs: update installation instructions
Adding Language Support¶
To add support for a new language:
- Create checker in
src/checkers/<language>.rs - Create formatter in
src/formatters/<language>.rs - Add language variant to
Languageenum insrc/lib.rs - Update extension mappings
- Add install hints
- Write tests
- Create documentation in
docs/languages/<language>.md
See existing implementations for reference.
Project Structure¶
src/
├── main.rs # CLI entry point
├── lib.rs # Main library
├── checkers/ # Language checkers
├── formatters/ # Language formatters
├── config/ # Configuration handling
├── plugin/ # Plugin system
├── cli/ # CLI commands
└── utils/ # Utility functions
Testing¶
Unit Tests¶
cargo test
Integration Tests¶
cargo test --test integration
Specific Test¶
cargo test test_name
Documentation¶
- Update docs in
docs/directory - Use MkDocs for local preview:
mkdocs serve - Keep README.md in sync with major changes
Questions?¶
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Check existing issues before creating new ones
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.