Thank you for your interest in contributing to singularity-code-analysis! This document provides guidelines and instructions for contributing.
- Rust 1.70 or later
- Cargo (comes with Rust)
- Git
# Clone the repository
git clone https://github.com/Singularity-ng/singularity-analysis.git
cd singularity-analysis
# Build the project
cargo build
# Run tests
cargo test --lib
# Check code quality
cargo fmt --check
cargo clippy-
Create a feature branch
git checkout -b feature/my-feature
-
Make your changes
- Follow Rust conventions and best practices
- Add tests for new functionality
- Update documentation as needed
-
Test your changes
# Run all tests cargo test --lib # Run specific tests cargo test --lib test_name
-
Format and lint
# Format code cargo fmt # Run linter cargo clippy --lib
-
Commit your changes
git add . git commit -m "feat: Add new feature"
Use conventional commit messages:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test changesrefactor:for refactoringchore:for maintenance
-
Push and create a pull request
git push origin feature/my-feature
- Follow standard Rust conventions (use
rustfmt) - Write descriptive variable and function names
- Add doc comments to public APIs using
/// - Keep functions focused and reasonably sized
- Use meaningful commit messages
- Write unit tests for new functions in the same file using
#[cfg(test)]modules - Use snapshot tests with
instafor complex output verification - Ensure all tests pass before submitting a PR
- Aim for good test coverage of new code
- Add doc comments to all public APIs
- Update README.md if adding major features
- Keep examples up to date
- Document any breaking changes in CHANGELOG.md
- Ensure CI passes (tests, formatting, linting)
- Provide a clear description of the changes
- Reference any related issues
- Keep PRs focused on a single feature or fix
- Respond to review comments promptly
When adding support for a new programming language:
- Add the tree-sitter grammar dependency to
Cargo.toml - Update the
mk_langs!macro insrc/langs.rs - Implement metrics for the language (at minimum: cognitive, cyclomatic, halstead)
- Add test cases in the relevant metric test files
- Update the README.md supported languages table
- Use GitHub Issues for bug reports and feature requests
- Provide a clear description and reproduction steps for bugs
- Include version information and environment details
- Search existing issues before creating new ones
- Do NOT open public issues for security vulnerabilities
- Report security issues privately to the maintainers
- See SECURITY.md for details
- Check existing documentation in
docs/ - Review closed issues and PRs for similar questions
- Ask questions in GitHub Discussions (if enabled)
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT OR Apache-2.0).