Contributing Guidelines
Thank you for your interest in contributing to hashreport! This document provides guidelines and instructions for contributing to the project.
Development Environment Setup
Prerequisites
- Python 3.10 or higher
- Git
- Poetry (Python package manager)
- Pre-commit hooks
Setting Up the Development Environment
-
Clone the Repository
-
Install Poetry
-
Install Dependencies
-
Set Up Pre-commit Hooks
-
Verify Setup
Running Tests
Running All Tests
# Run tests with coverage
poetry run pytest --cov=hashreport
# Run tests without coverage
poetry run pytest
# Run tests with verbose output
poetry run pytest -v
Running Specific Tests
# Run a specific test file
poetry run pytest tests/test_scanner.py
# Run a specific test function
poetry run pytest tests/test_scanner.py::test_scan_directory
# Run tests matching a pattern
poetry run pytest -k "test_scan"
Test Coverage
# Generate coverage report
poetry run pytest --cov=hashreport --cov-report=html
# View coverage in browser
open htmlcov/index.html
Code Style
Formatting
We use Black for code formatting:
# Format all Python files
poetry run black .
# Format a specific file
poetry run black hashreport/cli.py
Linting
We use Flake8 for linting:
# Lint all Python files
poetry run flake8
# Lint a specific file
poetry run flake8 hashreport/cli.py
Making Changes
1. Create a Branch
# Create and switch to a new branch
git checkout -b feature/your-feature-name
# Or create a bug fix branch
git checkout -b fix/your-bug-fix
2. Make Your Changes
- Write clear, concise code
- Add tests for new features
- Update documentation
- Follow the code style guidelines
3. Commit Your Changes
We use conventional commits:
Types:
Type | Description |
---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation changes |
style |
Code style changes |
refactor |
Code refactoring |
test |
Test changes |
chore |
Maintenance tasks |
4. Push Your Changes
5. Create a Pull Request
- Go to the GitHub repository
- Click "New Pull Request"
- Select your branch
- Fill in the PR template
- Submit the PR
Documentation
Updating Documentation
-
Update Source Code Documentation
- Add docstrings to new functions
- Update existing docstrings
- Follow Google style guide
-
Update User Documentation
- Edit files in the
docs/
directory - Update examples
- Add new features to relevant sections
- Edit files in the
-
Build Documentation
-
Preview Documentation
Getting Help
- Check the GitHub Issues
- Join the Discussions
- Contact the maintainers
License
By contributing, you agree that your contributions will be licensed under the project's AGPL-3.0 License.