Contributing to HATSA
Source:CONTRIBUTING.md
Thank you for your interest in contributing to HATSA! This document provides guidelines for contributing to the project.
π Getting Started
Development Setup
-
Fork and clone the repository
-
Install development dependencies
# Install package development tools install.packages(c("devtools", "roxygen2", "testthat", "styler", "covr")) # Install package dependencies devtools::install_deps(dependencies = TRUE)
-
Load the package for development
devtools::load_all()
π οΈ Development Workflow
Code Standards
- Style: We use the tidyverse style guide
-
Formatting: Run
styler::style_pkg()
before committing - Documentation: All functions must have complete roxygen2 documentation
- Testing: New code should include comprehensive tests
Making Changes
-
Create a feature branch
-
Write your code
- Follow existing code patterns
- Add comprehensive documentation
- Include appropriate tests
-
Test your changes
# Run tests devtools::test() # Check package devtools::check() # Check test coverage covr::package_coverage()
-
Style your code
styler::style_pkg()
Documentation
-
Functions: All exported functions need
@param
,@return
,@examples
, and@export
- Classes: S3 classes need clear documentation of structure and methods
- Vignettes: Complex features should include vignettes with examples
Example Documentation Template
#' Brief function description
#'
#' Longer description with details about what the function does.
#'
#' @param param1 Description of parameter 1
#' @param param2 Description of parameter 2
#' @return Description of what the function returns
#' @export
#' @examples
#' # Example usage
#' result <- my_function(param1 = "value", param2 = 123)
Testing
- Coverage: Aim for >90% test coverage
- Test types: Unit tests, integration tests, and edge cases
-
Test location: Place tests in
tests/testthat/test-*.R
Test Structure
test_that("function does what it should", {
# Setup
input <- create_test_data()
# Execute
result <- my_function(input)
# Verify
expect_equal(result$expected_field, expected_value)
expect_true(is.matrix(result$matrix_field))
})
π Pull Request Process
Before Submitting
-
Ensure all checks pass
devtools::check()
-
Run the full test suite
devtools::test()
-
Check code coverage
covr::package_coverage()
-
Update documentation
devtools::document()
PR Guidelines
- Title: Use a clear, descriptive title
- Description: Explain what changes you made and why
- Testing: Describe how you tested your changes
- Breaking changes: Clearly mark any breaking changes
PR Template
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] Added tests for new functionality
- [ ] Updated documentation
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] Tests added/updated
π Reporting Issues
Bug Reports
When reporting bugs, include:
-
R version: Output of
sessionInfo()
-
HATSA version:
packageVersion("hatsa")
- Minimal reproducible example
- Expected vs actual behavior
- Error messages (full traceback)
ποΈ Project Structure
hatsa/
βββ R/ # Source code
β βββ hatsa_core_algorithm.R # Main HATSA workflow
β βββ task_hatsa_main.R # Task-informed extensions
β βββ voxel_projection.R # NystrΓΆm voxel mapping
β βββ ... # Other modules
βββ tests/testthat/ # Test files
βββ man/ # Generated documentation
βββ vignettes/ # Package vignettes
βββ .github/workflows/ # CI/CD workflows
βββ DESCRIPTION # Package metadata
βββ NAMESPACE # Exported functions
π Resources
Learning Resources
- R Packages (2nd ed) - Comprehensive guide to R package development
- Advanced R - Deep dive into R programming
- testthat documentation - Testing framework
HATSA-Specific Resources
-
Mathematical background: See
planning-docs/
folder for algorithm specifications - API documentation: https://bbuchsbaum.github.io/hatsa/
- Project status: HATSA_PROJECT_STATUS.md
π€ Code of Conduct
Our Standards
- Respectful: Be respectful and constructive in discussions
- Inclusive: Welcome contributors from all backgrounds
- Collaborative: Help others learn and improve
- Professional: Maintain professional conduct in all interactions
Reporting Issues
If you experience or witness inappropriate behavior, please report it to brad.buchsbaum@gmail.com.