Skip to content

Contributing

Thank you for your interest in contributing to FSH Lint!

  • Report bugs
  • Suggest features
  • Improve documentation
  • Write code
  • Create custom rules
  • Help others in discussions
  • Rust 1.80 or later
  • Git
  • Familiarity with FSH (FHIR Shorthand)
  1. Fork the repository:
Terminal window
gh repo fork octofhir/fsh-lint-rs
  1. Clone your fork:
Terminal window
git clone https://github.com/YOUR_USERNAME/fsh-lint-rs.git
cd fsh-lint-rs
  1. Build the project:
Terminal window
cargo build --workspace
  1. Run tests:
Terminal window
cargo test --workspace
Terminal window
git checkout -b feature/my-feature
# or
git checkout -b fix/issue-123

Follow the project structure:

  • crates/fsh-lint-core - Core linting engine
  • crates/fsh-lint-rules - Rule engine and built-in rules
  • crates/fsh-lint-cli - Command-line interface
  • crates/fsh-lint-devtools - Developer tools

Add tests for new functionality:

#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_my_feature() {
// Test implementation
}
}
Terminal window
# Run all tests
cargo test --workspace
# Run specific test
cargo test --package fsh-lint-core --test my_test
# With output
cargo test -- --nocapture
Terminal window
cargo fmt --all
cargo clippy --all-targets --all-features

Follow conventional commits:

Terminal window
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 feature
  • fix: Bug fix
  • docs: Documentation
  • test: Tests
  • refactor: Code refactoring
  • perf: Performance improvement
  • chore: Maintenance
Terminal window
git push origin feature/my-feature

Then create a pull request on GitHub.

Follow Rust API Guidelines:

  • Use descriptive names
  • Prefer iterators over loops
  • Use Result for error handling
  • Document public APIs
  • Write integration tests
  • Add doc comments to public APIs
  • Include examples in doc comments
  • Update user documentation
  • Add changelog entries
  • Write unit tests for new code
  • Add integration tests for features
  • Include golden file tests for parser
  • Test error cases
  1. Create rule file in crates/fsh-lint-rules/src/builtin/:
use fsh_lint_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
}
}
  1. Register in crates/fsh-lint-rules/src/lib.rs

  2. Add tests in crates/fsh-lint-rules/tests/

  3. Add documentation in docs/

  1. Automated checks run (tests, clippy, fmt)
  2. Maintainer reviews code
  3. Address feedback
  4. Approval and merge
  • GitHub Discussions: Ask questions
  • GitHub Issues: Report bugs
  • Pull Requests: Contribute code

By contributing, you agree your code will be licensed under MIT or Apache-2.0.

Open a discussion on GitHub or reach out to maintainers.