CONTRIBUTING.md
November 23, 2024 ยท View on GitHub
Contributing Guidelines
Table of Contents
Code Styles
To ensure consistency throughout the source code, keep these rules in mind as you are working:
- All features or bug fixes must be tested by one or more specs (unit-tests).
- We use Biome.js to manage code style (both linter and formatter). An automated command is available (
pnpm run lint:fix).
Commit Message Guidelines
We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the project change log.
Commit Message Format
Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:
<type>(<scope>): <subject>
<body>
<footer>
The header is mandatory and the scope of the header is optional.
Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier to read on GitHub as well as in various git tools.
Type
The commit type must be one of the following:
feat: A new feature.fix: A bug fix.docs: Documentation only changes.style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc).refactor: A code change that neither fixes a bug nor adds a feature. For example, renaming a variable, moving a function, etc.perf: A code change that improves performance.test: Adding missing tests or correcting existing tests.build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm).ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs).chore: Other changes that don't modify src or test files. For example, updating build tasks, package manager configs, etc.revert: Reverts a previous commit.
Scope
The scope could be anything specifying place of the commit change.
The following is the list of supported scopes:
docs: for changes made ondocsdirectory.test: for changes made ontestdirectory.common/[sub-scope]: for changes made onsrc/commondirectory. Replacesub-scopewith available sub-directory incommon, like 'decorator', 'helper', etc. For example:common/decorator.province: for changes made onsrc/provincedirectory.regency: for changes made onsrc/regencydirectory.district: for changes made onsrc/districtdirectory.village: for changes made onsrc/villagedirectory.island: for changes made onsrc/islandfile.
If your change affect more than one package, separate the scopes with a comma (e.g. test,province).
Subject
The subject contains succinct description of the change:
- use the imperative, present tense: "change" not "changed" nor "changes".
- don't capitalize first letter.
- no dot (.) at the end.
Body
Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.
Footer
The footer should contain any information about Breaking Changes and is also the place to reference GitHub issues that this commit Closes.
Commit Message Example
feat(province): add new province endpoint
Add `/provinces/new` endpoint to create new province.
Closes #123
Submitting an Issue
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
You can report the issues by filling out the new issue form. Please select the right form template:
- Bug Report: if you found a bug in the source code.
- Feature Request: if you want a new feature or enhancement.
Submitting a Pull Request
Before you submit your Pull Request (PR) consider the following guidelines:
-
Search GitHub Pull Requests for an open or closed PR that relates to your submission. You don't want to duplicate effort.
-
Fork this repository.
-
Make your changes in a new git branch:
git checkout -b my-fix-branch master -
Follow the installation guides.
-
Create your patch, including appropriate test cases.
-
Make sure you follow our Code Styles and Commit Message Guidelines.
-
Run the full test suite and ensure that all tests pass.
-
Commit your changes using a descriptive commit message that follows our commit message conventions. Adherence to these conventions is necessary because release notes are automatically generated from these messages.
-
Push your branch to GitHub:
git push origin my-fix-branch -
In GitHub, send a pull request to
idn-area:main. -
If we suggest changes then:
-
Make the required updates.
-
Re-run the full test suite to ensure tests are still passing.
-
Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
git rebase master -i git push -f
That's it! Thank you for your contribution!