Code Contribution Workflow
This guide explains how to contribute code to the Andor's Trail project.
Overview
Andor's Trail uses GitHub for version control and collaboration. The contribution workflow follows a fork-and-pull-request model.
Prerequisites
Git is installed and configured.
GitHub account.
Development environment set up (see Development Environment Setup).
Understanding of Java and Android development.
Familiarity with the Andor's Trail codebase.
Step 1: Fork the Repository
Click the "Fork" button in the top-right corner.
Select your account (you now have your own copy of the repository).
Note the URL of your fork:
https://github.com/YOUR_USERNAME/andors-trail
Step 2: Clone Your Fork
bash# Clone your fork
git clone https://github.com/YOUR_USERNAME/andors-trail.git
cd andors-trail
# Add upstream remote (the original repository)
git remote add upstream https://github.com/AndorsTrailRelease/andors-trail.git
# Verify remotes
git remote -v
# Should show:
# origin → your fork
# upstream → original repositoryStep 3: Create a Feature Branch
Always create a new branch for your work:
Branch Naming Conventions
Use prefixes to categorize your branch:
fix/- Bug fixesfeature/- New featuresimprovement/- Code improvements or refactoringdocs/- Documentation updatestest/- Test additions or improvements
Follow with a descriptive name using hyphens (not spaces):
fix/combat-hit-chance-calculationfeature/new-actor-conditionimprovement/reduce-memory-usage
Step 4: Make Changes
Edit files in your IDE (Android Studio).
Follow the coding style guidelines (see below).
Build and test your changes.
Coding Style Guidelines
Java Code Style
Formatting Rules
Use 4 spaces for indentation (not tabs).
Maximum line length: 100 characters.
Add blank lines between methods.
Add spaces around operators:
a + b, nota+bOpen braces on same line:
if (condition) {notif (condition)\n{
Comments
Step 5: Test Your Changes
Build the Project
Run Tests
Test on Device/Emulator
Open Android Studio.
Click Run → Run 'AndorsTrail'.
Select an emulator or device.
Verify your changes work as expected.
Manual Testing
Test the specific feature you modified.
Test edge cases and error conditions.
Verify no regressions in other areas.
Document your testing in the PR description.
Step 6: Commit Changes
Use clear, descriptive commit messages:
Commit Message Format
Type:
fix:- Bug fixfeature:- New featurerefactor:- Code refactoringtest:- Test additionsdocs:- Documentation
Subject:
Use imperative mood ("fix", not "fixed").
Don't capitalize the first letter.
No period at the end.
Maximum 50 characters.
Body:
Explain what and why, not how.
Wrap at 72 characters.
Reference issue numbers:
Fixes #123,Closes #456
Example:
Step 7: Keep Your Branch Updated
Before submitting, sync with upstream:
Alternatively, merge if rebase is complex:
Step 8: Push to Your Fork
Step 9: Create a Pull Request
Visit your fork on GitHub,
Click "Compare & pull request" button,
Fill in the PR form:
PR Title
Clear, concise description:
"Fix combat hit chance calculation",
"Add new actor condition: Petrified",
"Optimize memory usage in map loading",
PR Description
Request reviewers (if known),
Click "Create pull request",
Step 10: Code Review
Reviewers will:
Examine your code,
Check for bugs and issues,
Verify adherence to style guidelines,
Request changes if needed,
Responding to Review Comments
Don't be defensive - feedback improves code quality,
Make requested changes in new commits,
Push changes to the same branch (automatically updates PR),
Reply to comments explaining changes,
Click "Resolve conversation" when addressed,
Addressing Review Feedback
Step 11: Merge
Once approved:
The maintainers will merge your PR.
Your branch can be deleted.
Changes are now in the main repository.
After Merge
Coding Standards
Javadoc Requirements
All public classes and methods must have Javadoc.
Describe purpose, parameters, return value, and exceptions.
Include example usage for complex methods.
Error Handling
Check for null values.
Handle expected exceptions.
Use meaningful error messages.
Log errors appropriately.
Testing Requirements
Write unit tests for new functionality.
Maintain or improve code coverage.
Test edge cases and error conditions.
Common Issues
PR Not Updating After Changes
Merge Conflicts
CI/CD Pipeline Failed
Check the build logs:
View logs in GitHub (GitHub Actions tab).
Fix issues indicated by failures.
Commit and push changes.
CI automatically reruns.
Review Checklist
Before submitting, verify:
Resources
Getting Help
Check existing issues and discussions.
Ask on Andor's Trail forums.
Comment on related GitHub issues.
Request help from maintainers.
Last updated