Coding Practices & Guidelines - StoryTime-Productions/Stweaks GitHub Wiki
Git Flow is a branching model that helps teams manage features, releases, and hotfixes in a structured way. It is especially useful for projects with scheduled release cycles.
Key Branches:
-
main
: Stores the official release history. -
develop
: Integration branch for features; contains the complete development history. -
feature/*
: Used for developing new features; branched fromdevelop
. -
release/*
: Used for release preparation; branched fromdevelop
, merged into bothmain
anddevelop
when finished. -
hotfix/*
: Used for quick fixes to production; branched frommain
, merged into bothmain
anddevelop
.
Typical Workflow:
- Create a
develop
branch frommain
. - Create
feature/*
branches fromdevelop
for new features. - Merge completed features back into
develop
. - Create
release/*
branches fromdevelop
for release preparation. - Merge finished releases into both
main
anddevelop
. - Create
hotfix/*
branches frommain
for urgent fixes, then merge into bothmain
anddevelop
.
Additional Resources:
- Atlassian Gitflow Workflow Guide
- AWS Prescriptive Guidance: Gitflow Branching Strategy
- A Successful Git Branching Model (Original Gitflow Blog)
- GitKraken: Best Practices for Git Branch Strategies
- Microsoft Learn: Git Branching Guidance
All code submitted to the repository must be accompanied by automated tests that achieve at least 80% code coverage. This means that at least 80% of the lines, branches, or statements in the codebase must be exercised by tests before a pull request can be merged.
Purpose:
- Ensures code reliability and maintainability.
- Reduces the risk of undetected bugs.
- Encourages writing tests alongside new features and bug fixes.
How to Check:
- Use the JaCoCo tool.
- Coverage reports will also be generated and reviewed as part of the CI pipeline.
Additional Resources:
- Atlassian: What is Code Coverage?
- LaunchDarkly: On Code Coverage in Software Testing
- LinkedIn: What is Acceptable Code Coverage?
All commit messages must follow the semantic commit message format, based on the Conventional Commits specification.
Format:
[optional scope]:
text
-
<type>
: Describes the kind of change (see below). -
[optional scope]
: The section or module affected (optional). -
<description>
: Short summary in the present tense.
Examples:
feat(login): add OAuth2 login support
fix(api): handle null pointer exception
docs: update README installation section
refactor(core): simplify data processing logic
test: add coverage for edge cases in parser
chore: update dependencies
Allowed Types:
-
feat
: New feature -
fix
: Bug fix -
docs
: Documentation only changes -
style
: Formatting, missing semi colons, etc; no code change -
refactor
: Code change that neither fixes a bug nor adds a feature -
test
: Adding or refactoring tests; no production code change -
chore
: Changes to the build process or auxiliary tools
Benefits:
- Improves readability and traceability of changes.
- Enables automated changelog generation and versioning.
- Helps reviewers quickly understand the intent of each commit.
Additional Resources: