Thank you for your interest in contributing to DevSweep! This document provides guidelines and instructions for contributing.
- Be respectful and inclusive
- Focus on constructive feedback
- Help maintain a welcoming environment
- macOS 10.15+
- Bash 5.0+
- Git
- Fork and clone the repository:
git clone https://github.com/your-username/devsweep.git
cd devsweep- Install development dependencies:
make setup- Run tests to verify setup:
make testdev_sweep/
├── bin/devsweep # Main entry point
├── src/
│ ├── modules/ # Cleanup modules
│ │ └── jetbrains.sh
│ └── utils/ # Shared utilities
│ ├── config.sh
│ ├── common.sh
│ └── menu.sh
└── tests/ # Test suite
└── unit/
git checkout -b feature/your-feature-nameUse prefixes:
feature/- New featuresfix/- Bug fixesdocs/- Documentationrefactor/- Code refactoringtest/- Test additions/fixes
Follow these coding standards:
- Use
set -euo pipefailin all scripts - Use
localfor function variables - Use
readonlyfor constants - Quote all variables:
"$var"not$var - Use
[[instead of[for conditionals - Prefer
$(command)over backticks - Use descriptive function names:
verb_nounpattern
# Brief description of what the function does
# Usage: function_name <arg1> <arg2>
# Returns: 0 on success, 1 on error
function_name() {
local arg1="$1"
local arg2="$2"
# Implementation
}- ALL destructive operations must use
safe_rmorsafe_kill - ALL destructive operations must respect
DRY_RUNflag - Validate all paths before deletion (no empty, root, or HOME)
- Use
confirm_dangerousfor operations that delete data
Every new function requires tests:
# tests/unit/mymodule_test.sh
function test_myfunction_handles_edge_case() {
# Setup
local input="test"
# Execute
myfunction "$input"
# Assert
assert_successful_code "$?"
}Run tests:
make test# Syntax check
make check
# Shellcheck linting
make lint# Dry-run to verify behavior
./bin/devsweep --dry-run --jetbrains
# Test help output
./bin/devsweep --help
# Test verbose mode
./bin/devsweep --verbose --dry-run --allUse conventional commits:
git commit -m "feat: add Docker cleanup module"
git commit -m "fix: handle empty JetBrains directory"
git commit -m "docs: update installation instructions"
git commit -m "test: add tests for safe_rm function"Prefixes:
feat:- New featurefix:- Bug fixdocs:- Documentationtest:- Testsrefactor:- Code refactoringchore:- Maintenance
git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
To add a new cleanup module:
Create src/modules/newmodule.sh:
#!/usr/bin/env bash
# newmodule.sh - Description of what this module cleans
set -euo pipefail
# Main entry point
# Usage: newmodule_clean
# Returns: 0 on success, 1 on error
newmodule_clean() {
log_section "New Module Cleanup"
# Your implementation here
# Use safe_rm, safe_kill, etc.
log_success "New module cleanup completed"
return 0
}In bin/devsweep, add:
# Source the module
source "$PROJECT_ROOT/src/modules/newmodule.sh"
# Add to argument parsing
--newmodule)
SELECTED_MODULES+=("newmodule")
shift
;;
# Add to execution
newmodule)
if newmodule_clean; then
log_success "Module completed: newmodule"
else
log_error "Module failed: newmodule"
((failed++))
fi
;;Create tests/unit/newmodule_test.sh:
#!/usr/bin/env bash
# Source dependencies
source "$PROJECT_ROOT/src/utils/config.sh"
source "$PROJECT_ROOT/src/utils/common.sh"
source "$PROJECT_ROOT/src/modules/newmodule.sh"
function test_newmodule_clean_succeeds() {
newmodule_clean
assert_successful_code "$?"
}- Add module description to README.md
- Add usage examples
- Document any special requirements
function setup() {
# Runs before each test
# Reset state, create temp directories
}
function teardown() {
# Runs after each test
# Clean up temp files
}
function test_descriptive_name() {
# Arrange
local input="test"
# Act
result=$(function_to_test "$input")
# Assert
assert_same "expected" "$result"
}assert_successful_code- Exit code is 0assert_general_error- Exit code is non-zeroassert_same- Exact matchassert_contains- Substring matchassert_empty- String is emptyassert_file_exists- File existsassert_directory_exists- Directory exists
# Mock a command
mock find echo "/fake/path/file.txt"
# Spy on a function
spy safe_rm
# Verify spy was called
assert_have_been_called safe_rm
assert_have_been_called_with safe_rm "/path/to/file"All pull requests are automatically tested using GitHub Actions. The CI/CD pipeline:
- Runs on every PR to
mainbranch - Executes all unit and end-to-end tests
- Must pass before the PR can be merged
- Shows results as a status check in the PR
You can view the workflow status:
- In the PR checks section
- On the Actions tab: https://github.com/Sstark97/dev_sweep/actions
- Tests pass locally (
make test) - CI/CD pipeline passes (GitHub Actions)
- Syntax checks pass (
make check) - Code follows style guide
- All functions have tests
- Destructive operations use safety wrappers
- Documentation updated
- Commit messages follow conventions
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
## Testing
How did you test this?
## Screenshots (if applicable)
## Additional Notes- Open an issue for bugs or feature requests
- Start a discussion for questions
- Join our community chat (coming soon)
Contributors will be recognized in:
- README.md contributors section
- Release notes
- Project documentation
Thank you for contributing to DevSweep!