🛠️ Development Guidelines

Satoshi Engineering · Engineering Handbook

Git Usage

Try to work on small issues that you can finish in a single commit. That commit should be added to the development branch directly. If the task is too big to be done in a single session, commit + push into feature branches and make sure to add them into the dev branch as soon as possible. Squashing a feature branch before adding it to the dev branch is a nice-to-have but optional.

Branch Naming


<what_is_it>/<what_is_it_about>_<from_where_did_it_come_from>

Branch refactor/deployment_develop

Branch refactor/#87_deployment_develop
        

Rebasing

Always try to rebase instead of merging. Rebase development onto main/production branch, feature branches onto development. Also when pulling changes use rebase:


git pull --rebase
# or set it globally:
git config --global pull.rebase true
        

Commit Message

We always use conventional commits. Also a `Refs` footer is always required.

Write the message in the present tense to describe what the commit changes, not what it changed.


git commit -m 'docs: update code-style guidelines

Refs: gitlab-project#1234'
        

Ideally add a githook that checks for the prefix and postfix: commit-msg hook

Code Style + Patterns

Make sure to familiarize yourself with existing code style and patterns when joining a new project. Ideally those things should be documented/added to the source repo.

Test Driven Development

The development of a new feature should follow the following procedure:

  1. TDD of the new feature
    1. write a unit test that fails with as little code as needed (compilation errors count)
    2. implement code until the unit test succeeds
    3. go back to a. until the feature is complete
  2. Refactor the code until it's "clean"!
  3. Write an integration test for the new feature
  4. Make sure the tests are also "clean"!
  5. Depending on the project: update documentation/faqs/etc.

Clean Code

We try to follow Clean Code

Class Structure


Static public variables
Static public methods

Instance public variables
Instance public methods

Static private variables
Static private methods

Instance private variables
Instance private methods

Caller above callee