Contributing
Thank you for your interest in contributing to Lindera! This page provides guidelines to help you get started.
Getting Started
-
Fork the repository on GitHub.
-
Clone your fork locally:
git clone https://github.com/<your-username>/lindera.git cd lindera -
Create a feature branch:
git checkout -b feature/my-feature -
Make your changes, then verify they pass all checks:
cargo fmt --all -- --check cargo clippy -- -D warnings cargo test -
Commit and push your changes, then open a pull request.
Code Style
- Follow the existing code style in the repository.
- Run
cargo fmtbefore committing. - All public and private items (types, functions, modules, fields, constants, type aliases) must have documentation comments (
///). - Trait implementation methods should also have documentation comments describing implementation-specific behavior.
- Function and method documentation should include
# Argumentsand# Returnssections where applicable. - Code comments, documentation comments, commit messages, log messages, and error messages should be written in English.
- Avoid
unwrap()andexpect()in production code (test code is fine). - Use
unsafeblocks only when necessary, and always include a// SAFETY: ...comment. - Use file-based module style (
src/tokenizer.rs) instead ofmod.rsstyle.
Testing
-
Write unit tests for all new functionality.
-
Run the relevant test(s) during development for fast feedback:
cargo test -p <crate> <test_name> -
When working with the
trainfeature, include the feature flag:cargo test -p lindera-dictionary --features train
Commit Messages
Follow the Conventional Commits specification. Write commit messages in English.
Examples:
feat: add Korean dictionary supportfix: correct character category ID in trainerdocs: update installation instructionsrefactor: split large training method into smaller functions
Documentation
-
If your change affects user-facing documentation, update the relevant files in
docs/src/. -
After editing Markdown files, verify there are no lint errors:
markdownlint-cli2 "docs/src/**/*.md" -
Rules are configured in
.markdownlint.jsonat the repository root.
Dependencies
When adding new dependencies, verify license compatibility. Lindera uses the MIT / Apache-2.0 dual license.
Feature Flags
Use #[cfg(feature = "train")] for conditional compilation of training-related code. See Feature Flags for a full list.
Reporting Issues
When reporting a bug, please include:
- Lindera version (
lindera --versionor checkCargo.toml) - Rust version (
rustc --version) - Operating system
- Steps to reproduce the issue
- Expected and actual behavior