Thank you for your interest in contributing! This document provides guidelines for reporting issues, submitting code, and participating in the project.
🤝 Code of Conduct
- Be respectful and constructive in all discussions
- Welcome all contributors regardless of background or experience
- Focus on the code, not the person
- Provide helpful feedback and be open to receiving it
- Report inappropriate behavior to the maintainers
🚀 Getting Started
Prerequisites
- R 3.5.0 or later
- Git installed and configured
- GitHub account
- Basic knowledge of R and Git workflows
🐛 Reporting Issues
Before Reporting
- Check existing issues to avoid duplicates
- Search closed issues in case it’s already been resolved
- Verify the issue occurs with the latest version
Creating an Issue
Please include:
Clear title - Briefly describe the issue
Description - Detailed explanation of the problem
R version - Output of
R.versionEnvironment - Operating system (Windows/Mac/Linux)
-
Reproduction steps:
# Minimal reproducible example source("script-name.R") function_call() # What triggers the issue Expected behavior - What should happen
Actual behavior - What actually happens
Error messages - Full error output if applicable
Screenshots - If relevant to the issue
📝 Submitting Changes
1. Create Your Feature Branch
Branch naming conventions: - feature/ - New functionality - fix/ - Bug fix - docs/ - Documentation only - refactor/ - Code restructuring (no behavior change) - test/ - Adding or updating tests
2. Make Your Changes
Single Responsibility: Each change should address one issue/feature
Keep it focused: Avoid mixing unrelated changes
File organization: Follow the existing structure
3. Test Your Changes
Before submitting:
# Load and test your modified script
source("modified-script.R")
# Test the interactive prompts
function_name()
# Verify no errors or warningsImportant: Test across different scenarios: - With valid inputs - With edge cases - With invalid/missing inputs - In a clean R session
4. Commit Your Changes
See Commit Message Guidelines below.
6. Create a Pull Request
- Go to GitHub and click “New Pull Request”
- Select your fork and branch
- Fill out the PR template with:
- Title - Clear, descriptive title
- Description - What changes, why, and what issues it fixes
- Type - Bug fix, feature, enhancement, documentation
- Related Issues - Link to any related issues (#123)
- Checklist - Confirm you’ve followed guidelines
File Organization
Scripts are organized by functionality in the following directories:
Package Management (package-management/) - Package removal, auditing, scanning, cleanup
Memory Management (memory-management/) - Memory cleanup, cache sweeping, garbage collection
Development Environment (dev-environment/) - Git setup, tool bootstrapping, pre-commit hooks, session logging
Session Management (session-management/) - State auditing, function masking detection, environment snapshots
Batch Processing (batch-processing/) - Memory-safe loops, checkpoint recovery, network operations
Code Generation (code-generation/) - Release automation, vignette scaffolding, test generation, clean-room testing
Privacy (privacy/) - Data anonymization, PII removal, pseudonymization
Utilities (utilities/) - Miscellaneous utilities and specialized tools
When adding new scripts: 1. Choose the most appropriate directory 2. If creating a new category, create a new directory 3. Include a README.md in the directory explaining its contents 4. Update the main README.md with links to your new directory 5. Reference your scripts in the appropriate section
R Naming Conventions
# Functions: snake_case
my_function <- function() {
# Code
}
# Variables: snake_case
my_variable <- 123
data_frame <- data.frame()
# Constants: UPPER_SNAKE_CASE
DEFAULT_THRESHOLD <- 50
MAX_ATTEMPTS <- 5Code Formatting
# Spacing around operators
x <- 1 + 2 # Good
x<-1+2 # Bad
# Function calls
result <- my_function(arg1, arg2)
result <- my_function(
arg1 = value1,
arg2 = value2
)
# If statements
if (condition) {
# Code
} else {
# Code
}
# Loops
for (i in seq_len(n)) {
# Code
}Function Documentation
Add roxygen-style comments:
#' Brief description of function
#'
#' Longer explanation of what the function does, when to use it,
#' and any important side effects.
#'
#' @param arg_name Description of argument
#' @param arg_name2 Description of second argument
#'
#' @return Description of what is returned
#'
#' @examples
#' \dontrun{
#' my_function(arg_name = value)
#' }
#'
#' @export
my_function <- function(arg_name, arg_name2 = default) {
# Implementation
}Comments in Code
# Use clear, descriptive comments
# Explain the "why", not the "what"
# Bad:
x <- x + 1 # Add 1 to x
# Good:
# Increment counter for next iteration
x <- x + 1
# Multi-line comment for complex logic
# Check if threshold exceeded before proceeding
# This prevents unnecessary processing
if (value > threshold) {
# Process
}Error Handling
# Include helpful error messages
if (!file.exists(filename)) {
stop(sprintf("File not found: '%s'. Please check the path.", filename))
}
# Use informative warnings
if (length(items) == 0) {
warning("No items to process. Returning empty result.")
return(invisible(NULL))
}
# Use tryCatch for recovery
result <- tryCatch({
risky_operation()
}, error = function(e) {
message(sprintf("Error during processing: %s", e$message))
return(NULL)
})Interactive Prompts
When using select.list() or readline():
# Provide clear prompts
choice <- select.list(
choices = c("Option A", "Option B", "Cancel"),
title = "What would you like to do?"
)
# Validate input
threshold <- readline(prompt = "Enter threshold (default: 50): ")
threshold <- suppressWarnings(as.numeric(threshold))
if (is.na(threshold)) {
message("Invalid input. Using default value of 50.")
threshold <- 50
}📌 Commit Message Guidelines
Use the following format for commit messages:
<type>: <subject>
<body>
<footer>
Type
-
feat- New feature -
fix- Bug fix -
docs- Documentation only -
style- Code style changes (formatting, missing semicolons, etc.) -
refactor- Code refactoring without behavior change -
test- Adding or updating tests -
chore- Maintenance tasks
Subject
- Use imperative mood (“add” not “added”)
- Don’t capitalize first letter
- No period at the end
- Limit to 50 characters
Body
- Explain what and why, not how
- Wrap at 72 characters
- Separate from subject with blank line
- Use bullet points for multiple changes
Footer
- Reference issues:
Fixes #123,Closes #456 - Note breaking changes:
BREAKING CHANGE: description
Examples
feat: add memory_sweeper function
Add interactive function to clean large objects from global environment.
Includes threshold configuration and garbage collection trigger.
Fixes #45
fix: prevent infinite loop in network_diplomat
Add max_retries check to prevent infinite retry loops
when server is unresponsive.
Closes #78
docs: update README with usage examples
Add clear examples for each script category to help
new users get started quickly.
🧪 Testing
When to Write Tests
- New functions
- Bug fixes (add test that reproduces the bug first)
- Important features
- Edge cases and error conditions
📚 Documentation
README Updates
- Update main README.md to reference new scripts/directories
- Update directory-specific README.md files
- Add usage examples and best practices
- Include links to related scripts in “Related” sections
👀 Review Process
What We Look For
- Correctness - Does it work as intended?
- Code Quality - Follows style guidelines and best practices
- Documentation - Clear comments and function documentation
- Testing - Tested thoroughly, including edge cases
- Breaking Changes - Clearly documented if not backward compatible
- Performance - No unnecessary slowdowns
🙏 Thank You
Your contributions make this project better! Whether it’s: - Reporting bugs - Helps identify problems - Suggesting features - Inspires improvements - Writing documentation - Helps others learn - Submitting code - Adds functionality - Testing - Ensures quality
We appreciate all types of contributions!
📞 Questions?
- Check existing issues and discussions
- Read through this guide thoroughly
- Open a discussion if unsure
- Ask in a new issue (label with
question)
