Thank you for your interest in contributing to ld-decode! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- How to Contribute
- Development Workflow
- Coding Standards
- Testing
- Submitting Changes
- Community
This project is run by volunteers and we expect all contributors to be respectful and constructive. Please:
- Be welcoming and inclusive
- Be respectful of differing viewpoints and experiences
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards other community members
Before contributing, make sure you have:
- A GitHub account
- Git installed and configured
- Development environment set up (see BUILD.md)
- Basic understanding of C++17, Python, and CMake
See BUILD.md for complete build instructions. Quick reference:
# Clone the repository with submodules
git clone --recurse-submodules https://github.com/happycube/ld-decode.git
cd ld-decode
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install for development
pip install -e ".[dev]"
# Run tests
pytest --output-on-failureFor Python development, see the virtual environment section in INSTALL.md.
Quick reference:
python3 -m venv ~/ld-decode-venv
source ~/ld-decode-venv/bin/activate
pip install -r requirements.txt
pip install -e .Before creating a bug report:
- Check the existing issues to avoid duplicates
- Gather information about the bug:
- Operating system and version
- ld-decode version (git commit hash)
- Steps to reproduce
- Expected vs. actual behavior
- Relevant logs or error messages
Create a detailed bug report including:
**Environment:**
- OS: Ubuntu 22.04
- ld-decode commit: abc123def
- Qt version: 6.x.x
**Steps to Reproduce:**
1. Run `ld-decode myfile.ldf`
2. Click on X
3. Observe Y
**Expected Behavior:**
Should do Z
**Actual Behavior:**
Does W instead
**Logs:**[paste relevant logs]
Enhancement suggestions are welcome! Please:
- Check if the feature has already been requested
- Provide a clear and detailed explanation of the feature
- Explain why this enhancement would be useful
- Include examples of how the feature would be used
Areas where contributions are particularly welcome:
- Bug fixes: Fixing existing issues
- Performance improvements: Optimizing decoding algorithms
- Documentation: Improving docs, comments, and examples
- Testing: Adding tests for existing functionality
- Platform support: Improving Windows/macOS compatibility
- New features: After discussion with maintainers
# Fork the repository on GitHub, then clone your fork
git clone --recurse-submodules https://github.com/YOUR_USERNAME/ld-decode.git
cd ld-decode
# Add upstream remote
git remote add upstream https://github.com/happycube/ld-decode.git
# If you already cloned without --recurse-submodules, initialize testdata:
git submodule update --init --recursive# Update your local main branch
git checkout main
git pull upstream main
# Create a feature branch
git checkout -b feature/my-new-feature
# or
git checkout -b fix/bug-descriptionBranch naming conventions:
feature/description- For new featuresfix/description- For bug fixesdocs/description- For documentation changesrefactor/description- For code refactoring
- Write clear, readable code
- Follow existing code style
- Add comments for complex logic
- Update documentation as needed
- Add tests for new functionality
# Run all tests
pytest --output-on-failure
# Run specific tests
pytest tests/test_chroma.py --output-on-failure
# Run with coverage
pytest --cov=lddecode
# Test manually with your changes
python -c "import lddecode; print('Import successful')"Write clear, descriptive commit messages:
git add .
git commit -m "Short description of change
Longer explanation of what changed and why. Reference any
related issues.
Fixes #123Commit message guidelines:
- Use present tense ("Add feature" not "Added feature")
- Use imperative mood ("Move cursor to..." not "Moves cursor to...")
- First line should be 50 characters or less
- Reference issues and pull requests when relevant
# Fetch latest changes from upstream
git fetch upstream
# Rebase your branch on upstream/main
git rebase upstream/main
# If there are conflicts, resolve them and continue
git rebase --continuegit push origin feature/my-new-feature-
Standard: C++17
-
Style: Follow existing code style in the project
-
Naming:
- Classes:
PascalCase - Functions/methods:
camelCase - Variables:
camelCase - Constants:
UPPER_CASE - Private members:
camelCase(some older code usesm_prefix, but this is not required for new code)
- Classes:
-
Best Practices:
- Use
constwhere appropriate - Prefer smart pointers over raw pointers
- Use
nullptrinstead ofNULL - Avoid
using namespace std; - Include guards or
#pragma once
- Use
Example:
class VideoDecoder {
public:
VideoDecoder(int width, int height);
bool decodeFrame(const FrameData& data);
private:
int width; // Modern style
int height; // Modern style
std::vector<uint8_t> buffer;
};- Standard: Python 3.6+
- Style: Follow PEP 8
- Formatting: 4 spaces for indentation (no tabs)
- Imports: Group standard library, third-party, and local imports
- Documentation: Use docstrings for functions and classes
Example:
def decode_video(input_file, output_file, system='pal'):
"""Decode video from TBC file.
Args:
input_file (str): Path to input TBC file
output_file (str): Path to output file
system (str): Video system ('pal' or 'ntsc')
Returns:
bool: True if successful, False otherwise
"""
# Implementation
pass- Use lowercase for commands
- Indent with 4 spaces
- Use modern CMake practices (targets, not variables)
Example:
add_executable(ld-analyse
main.cpp
mainwindow.cpp
)
target_link_libraries(ld-analyse
PRIVATE
Qt6::Core
Qt6::Widgets
lddecode-library
)# Run all tests
pytest
# Run with verbose output
pytest -v
# Run specific test file
pytest tests/test_core.py
# Run with coverage report
pytest --cov=lddecode --cov-report=html
# Run in parallel
pytest -n autoWhen adding new features:
- Add pytest test files in
tests/directory - Name test files
test_*.py - Use descriptive test function names starting with
test_ - Ensure tests are deterministic
- Tests should run quickly
Example test:
import pytest
from lddecode.core import LDDecode
def test_basic_import():
"""Test that the module can be imported."""
assert LDDecode is not None
def test_decode_frame():
"""Test basic frame decoding."""
# Your test implementation
pass- Use descriptive test names
Example test structure:
# In cmake_modules/LdDecodeTests.cmake
add_test(
NAME my-new-test
COMMAND ${CMAKE_BINARY_DIR}/tools/my-tool/my-tool --test-flag
)- Use existing test data in
testdata/when possible - Keep test files small and focused
- Document any new test data requirements
-
Ensure your code builds and tests pass
pip install -e ".[dev]" pytest -
Update documentation
- Update README.md if needed
- Add/update comments in code
- Update relevant .md files
-
Push to your fork
git push origin feature/my-new-feature
-
Create Pull Request
- Go to your fork on GitHub
- Click "New Pull Request"
- Select your feature branch
- Fill in the PR template with:
- Description of changes
- Motivation and context
- Related issues
- Testing performed
- Screenshots (if UI changes)
-
Address Review Feedback
- Respond to reviewer comments
- Make requested changes
- Push updates to the same branch
- Re-request review when ready
A good pull request:
- Focused: Addresses one issue or feature
- Tested: Includes tests and passes existing tests
- Documented: Includes updated documentation
- Clean: Well-formatted code with clear commit history
- Descriptive: Clear PR description explaining what and why
PR Description Template:
## Description
Brief description of changes
## Motivation
Why is this change needed?
## Related Issues
Fixes #123
Related to #456
## Changes Made
- Added X
- Modified Y
- Removed Z
## Testing
- [ ] All tests pass
- [ ] Tested manually with [describe test case]
- [ ] Added new tests for [feature]
## Screenshots (if applicable)
[Add screenshots here]
## Checklist
- [ ] Code follows project style guidelines
- [ ] Documentation updated
- [ ] Tests added/updated
- [ ] All tests pass- Maintainers will review your PR
- You may be asked to make changes
- Once approved, a maintainer will merge your PR
- Your contribution will be credited in the commit history
By contributing to ld-decode, you agree that your contributions will be licensed under the GPL-3.0 license.
If you have questions about contributing:
- Check the ld-decode documentation
- Search existing issues
- Ask in the Discord server
- Open a new issue with your question
Thank you for contributing to ld-decode! 🎉