Thank you for your interest in contributing to ChafficLib! This document outlines our standards and processes for contributing.
- Code of Conduct
- Branch Strategy
- Commit Messages
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation Requirements
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Report unacceptable behavior to maintainers
type/issue-id-short-description
feature/
- New featuresbugfix/
- Bug fixeshotfix/
- Critical fixes for productionrelease/
- Release preparationdocs/
- Documentation updatestest/
- Test additions or modificationsrefactor/
- Code refactoringchore/
- Maintenance tasks
feature/GUI-123-add-pagination
bugfix/DB-456-fix-connection-leak
docs/DOC-789-update-api-docs
main
└── develop
├── feature/...
├── bugfix/...
└── release/...
main
- Production codedevelop
- Integration branch- Feature/bugfix branches branch off from
develop
- Hotfixes branch off from
main
type(scope): short description
[optional body]
[optional footer]
feat
: New featurefix
: Bug fixdocs
: Documentation changesstyle
: Code style changes (formatting, etc.)refactor
: Code changes that neither fix bugs nor add featuresperf
: Performance improvementstest
: Adding or modifying testschore
: Maintenance tasks
Specifies the component affected:
gui
db
config
events
cmd
effects
items
stats
feat(gui): add inventory pagination system
- Implemented PageableInventory class
- Added navigation buttons
- Created ItemSlotCalculator utility
Closes #123
fix(db): resolve connection pool memory leak
Connection wasn't properly closed in transaction rollback.
Added finally block to ensure proper cleanup.
Fixes #456
- Create feature/bugfix branch from
develop
- Make changes following coding standards
- Ensure tests pass and coverage meets 80%
- Update documentation
- Submit PR to
develop
- Wait for review
- Address feedback
- Merge after approval
type(scope): short description (#issue-number)
Example: feat(gui): implement inventory pagination (#123)
- Follow Kotlin Coding Conventions
- Use Kotlin idioms (e.g.,
when
,let
,apply
) - Prefer immutability (
val
overvar
)
de.chafficplugins.chafficlib/
├── gui/
├── config/
├── database/
├── items/
├── effects/
├── events/
├── commands/
└── util/
class MyClass {
// Constants
companion object {
private const val CONSTANT = "value"
}
// Properties
private val property: Type
// Constructors
init {
// Initialization
}
// Public methods
fun publicMethod() {
// Implementation
}
// Private methods
private fun helperMethod() {
// Implementation
}
}
- Classes: PascalCase (
InventoryBuilder
) - Functions: camelCase (
createInventory
) - Properties: camelCase (
playerData
) - Constants: SCREAMING_SNAKE_CASE (
MAX_INVENTORY_SIZE
) - Files: PascalCase matching class name (
InventoryBuilder.kt
)
- Methods should be 30 lines or less
- Break down complex methods into smaller ones
- Use meaningful method names
- Use KDoc for all public APIs
- Include code examples for complex features
- Document assumptions and edge cases
class MyClassTest {
// Setup
@BeforeEach
fun setup() {
// Test setup
}
// Tests grouped by functionality
@Nested
inner class FeatureTests {
@Test
fun `should do something when condition`() {
// Test implementation
}
}
}
Format: should_expectedBehavior_when_condition
Example: should_throwException_when_inventoryIsFull
- Minimum 70% code coverage
- 100% coverage for critical components
- Test all edge cases
- Include both positive and negative tests
- Every public API must have KDoc
- Include:
- Function purpose
- Parameters
- Return values
- Exceptions
- Example usage
/**
* Creates a paginated inventory with navigation buttons.
*
* @param title The inventory title
* @param size The size of each page (must be multiple of 9)
* @param items The items to display
* @throws IllegalArgumentException if size is not multiple of 9
* @return The created inventory
*
* @example
* val inventory = createPaginatedInventory(
* title = "My Items",
* size = 54,
* items = itemList
* )
* ```
*/
fun createPaginatedInventory(
title: String,
size: Int,
items: List<ItemStack>
): Inventory
- Maintain CHANGELOG.md
- Follow Keep a Changelog
- Update for each release
- Create release branch (
release/vX.Y.Z
) - Update version numbers
- Update CHANGELOG.md
- Create PR to
main
- After merge, tag release
- Merge back to
develop