Contributing
Thank you for your interest in contributing to maki!
maki is a high-performance toolchain for FHIR Shorthand (FSH) that provides linting, formatting, building, and language server capabilities.
Ways to Contribute
Section titled “Ways to Contribute”- Report bugs
- Suggest features
- Improve documentation
- Write code
- Create custom rules
- Help others in discussions
Getting Started
Section titled “Getting Started”Prerequisites
Section titled “Prerequisites”- Rust 1.80 or later
- Git
- Familiarity with FSH (FHIR Shorthand)
Development Setup
Section titled “Development Setup”- Fork the repository:
gh repo fork octofhir/maki- Clone your fork:
git clone https://github.com/YOUR_USERNAME/maki.gitcd maki- Build the project:
cargo build --workspace- Run tests:
cargo test --workspaceDevelopment Workflow
Section titled “Development Workflow”1. Create a Branch
Section titled “1. Create a Branch”git checkout -b feature/my-feature# orgit checkout -b fix/issue-1232. Make Changes
Section titled “2. Make Changes”Follow the project structure:
crates/maki-core- Core library with parser, semantic analyzer, and exporterscrates/maki-rules- Rule engine and built-in rulescrates/maki-cli- Command-line interface (binary: maki)crates/maki-lsp- Language Server Protocol implementation (stub)crates/maki-formatter- Formatter API wrapper (stub)crates/maki-test- Testing framework for FSH resources (stub)crates/maki-devtools- Developer tools
3. Write Tests
Section titled “3. Write Tests”Add tests for new functionality:
#[cfg(test)]mod tests { use super::*;
#[test] fn test_my_feature() { // Test implementation }}4. Run Tests
Section titled “4. Run Tests”# Run all testscargo test --workspace
# Run specific testcargo test --package maki-core --test my_test
# With outputcargo test -- --nocapture5. Format Code
Section titled “5. Format Code”cargo fmt --allcargo clippy --all-targets --all-features6. Commit Changes
Section titled “6. Commit Changes”Follow conventional commits:
git add .git commit -m "feat: add new rule for profile validation"git commit -m "fix: correct cardinality checking logic"git commit -m "docs: update installation guide"Commit types:
feat: New featurefix: Bug fixdocs: Documentationtest: Testsrefactor: Code refactoringperf: Performance improvementchore: Maintenance
7. Push and Create PR
Section titled “7. Push and Create PR”git push origin feature/my-featureThen create a pull request on GitHub.
Code Guidelines
Section titled “Code Guidelines”Rust Style
Section titled “Rust Style”Follow Rust API Guidelines:
- Use descriptive names
- Prefer iterators over loops
- Use
Resultfor error handling - Document public APIs
- Write integration tests
Documentation
Section titled “Documentation”- Add doc comments to public APIs
- Include examples in doc comments
- Update user documentation
- Add changelog entries
Testing
Section titled “Testing”- Write unit tests for new code
- Add integration tests for features
- Include golden file tests for parser
- Test error cases
Adding a New Rule
Section titled “Adding a New Rule”- Create rule file in
crates/maki-rules/src/builtin/:
use maki_core::{LintContext, Diagnostic, Severity};use crate::Rule;
pub struct MyRule;
impl Rule for MyRule { fn name(&self) -> &str { "category/my-rule" }
fn category(&self) -> RuleCategory { RuleCategory::Style }
fn severity(&self) -> Severity { Severity::Warning }
fn lint(&self, context: &mut LintContext) { // Implementation }}-
Register in
crates/maki-rules/src/lib.rs -
Add tests in
crates/maki-rules/tests/ -
Add documentation in
docs/
Review Process
Section titled “Review Process”- Automated checks run (tests, clippy, fmt)
- Maintainer reviews code
- Address feedback
- Approval and merge
Community
Section titled “Community”- GitHub Discussions: Ask questions
- GitHub Issues: Report bugs
- Pull Requests: Contribute code
License
Section titled “License”By contributing, you agree your code will be licensed under MIT or Apache-2.0.
Questions?
Section titled “Questions?”Open a discussion on GitHub or reach out to maintainers.