Contributing to Casys RPG
Thank you for your interest in contributing to Casys RPG! This document provides guidelines and instructions for contributing to the project.
Table of Contents
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Documentation
- Submitting Changes
Code of Conduct
This project follows a Code of Conduct that all contributors are expected to adhere to. Please read Code of Conduct before contributing.
Getting Started
- Fork the repository
- Clone your fork:
- Add the upstream repository:
Development Setup
-
Create a virtual environment:
-
Activate the environment:
-
Install dependencies:
-
Install development dependencies:
Making Changes
Branch Naming Convention
- Feature:
feature/description
- Bug fix:
fix/description
- Documentation:
docs/description
- Performance:
perf/description
Coding Standards
We follow these principles: - SOLID Design Principles - DRY (Don't Repeat Yourself) - KISS (Keep It Simple, Stupid) - YAGNI (You Aren't Gonna Need It)
Code Style
- Follow PEP 8
- Use type hints
- Document all public functions and classes
- Keep functions focused and small
- Use meaningful variable names
Example:
from typing import Optional
def process_section(
section_number: int,
content: Optional[str] = None
) -> bool:
"""Process a game section.
Args:
section_number: Section identifier
content: Optional section content
Returns:
bool: True if processing successful
"""
# Implementation
Testing
Running Tests
# Run all tests
pytest
# Run specific test file
pytest tests/test_rules_agent.py
# Run with coverage
pytest --cov=casys_rpg tests/
Writing Tests
- Place tests in the
tests/
directory - Follow the naming convention:
test_*.py
- Use descriptive test names
- Include both positive and negative tests
- Mock external dependencies
Example:
def test_process_section_valid_input():
# Arrange
section_number = 1
content = "Test content"
# Act
result = process_section(section_number, content)
# Assert
assert result is True
Documentation
Code Documentation
- Use docstrings for all public APIs
- Follow Google style docstrings
- Include type hints
- Document exceptions
Project Documentation
- Update relevant .md files
- Keep the API documentation current
- Add examples for new features
- Update the changelog
Submitting Changes
-
Create a new branch:
-
Make your changes:
-
Push to your fork:
-
Create a Pull Request
Pull Request Guidelines
- Use the PR template
- Reference any related issues
- Include tests
- Update documentation
- Follow commit message convention
Commit Message Format
Types: - feat: New feature - fix: Bug fix - docs: Documentation - style: Formatting - refactor: Code restructuring - test: Adding tests - chore: Maintenance
Example:
feat(rules): add dice roll validation
- Add input validation for dice rolls
- Implement result calculation
- Add unit tests
Closes #123
Review Process
- Automated checks must pass
- Code review by maintainers
- Documentation review
- Testing verification
- Final approval
Getting Help
- Create an issue
- Join our Discord server
- Check the documentation
- Contact maintainers
Thank you for contributing to Casys RPG!