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

  1. Click the "Fork" button in the top-right corner.

  2. Select your account (you now have your own copy of the repository).

  3. 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 repository

Step 3: Create a Feature Branch

Always create a new branch for your work:

Branch Naming Conventions

Use prefixes to categorize your branch:

  • fix/ - Bug fixes

  • feature/ - New features

  • improvement/ - Code improvements or refactoring

  • docs/ - Documentation updates

  • test/ - Test additions or improvements

Follow with a descriptive name using hyphens (not spaces):

  • fix/combat-hit-chance-calculation

  • feature/new-actor-condition

  • improvement/reduce-memory-usage

Step 4: Make Changes

  1. Edit files in your IDE (Android Studio).

  2. Follow the coding style guidelines (see below).

  3. 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, not a+b

  • Open braces on same line: if (condition) { not if (condition)\n{

Comments

Step 5: Test Your Changes

Build the Project

Run Tests

Test on Device/Emulator

  1. Open Android Studio.

  2. Click Run → Run 'AndorsTrail'.

  3. Select an emulator or device.

  4. 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 fix

  • feature: - New feature

  • refactor: - Code refactoring

  • test: - Test additions

  • docs: - 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

  1. Visit your fork on GitHub,

  2. Click "Compare & pull request" button,

  3. 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

  1. Request reviewers (if known),

  2. 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

  1. Don't be defensive - feedback improves code quality,

  2. Make requested changes in new commits,

  3. Push changes to the same branch (automatically updates PR),

  4. Reply to comments explaining changes,

  5. Click "Resolve conversation" when addressed,

Addressing Review Feedback

Step 11: Merge

Once approved:

  1. The maintainers will merge your PR.

  2. Your branch can be deleted.

  3. 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:

  1. View logs in GitHub (GitHub Actions tab).

  2. Fix issues indicated by failures.

  3. Commit and push changes.

  4. 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