Contributing to CodestatsAPI
View SourceCodestatsAPI is written in Elixir.
For branching management, this project uses git-flow. The main branch is reserved for releases: the development process occurs on the develop and feature branches. Please never commit to main.
You can use asdf to set up the required Elixir and OTP. Current versions are listed in the .tool-versions file.
Setup
Local repository
Fork the repository.
Clone your fork to a local repository:
git clone https://github.com/your-login/codestats_api.git cd codestats_apiCheckout
develop:git checkout develop
Development environment (using asdf)
Install asdf by Getting Started guideline
Add plugins for elixir and OTP
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.gitInstall tools:
cd codestats_api asdf install
Development environment (without asdf)
Please see installation instructions.
Git-flow
If you want to use the git-flow CLI, please check installation instructions.
Building the project
Fetch the project dependencies:
cd codestats_api mix deps.getRun the static analyzers:
mix check
Workflow
To make a change, please use this workflow:
Checkout
developand apply the last upstream changes (use rebase, not merge!):git checkout develop git fetch --all --prune git rebase upstream/developFor a tiny patch, create a new branch with an explicit name:
git checkout -b <my_branch>Alternatively, if you are working on a feature that would need more work, you can create a feature branch with
git-flow:git flow feature start <my_feature>Note: always open an issue and ask before starting a big feature, to avoid it not being merged and your time lost.
When your feature is ready, feel free to use interactive rebase so your history looks clean and easy to follow. Then, apply the last upstream changes on
developto prepare integration:git checkout develop git fetch --all --prune git rebase upstream/developIf there were commits on
developsince the beginning of your feature branch, integrate them by rebasing if your branch has few commits, or merging if you had a long-lived branch:git checkout <my_feature_branch> git rebase developNote: the only case you should merge is when you are working on a big feature. If it is the case, we should have discussed this before as stated above.
Run the tests and static analyzers to ensure there is no regression and all works as expected:
mix checkIf it’s all good, open a pull request to merge your branch into the
developbranch on the main repository.
Coding style
Please format your code with mix format or your editor and follow
this style guide.
All contributed code must be documented and functions must have typespecs. In general, take your inspiration from the existing code.