Skip to content

Latest commit

 

History

History
94 lines (71 loc) · 4.9 KB

CONTRIBUTING.md

File metadata and controls

94 lines (71 loc) · 4.9 KB

How to Contribute

First of all, thank you for wanting to contribute to dicognito! We really appreciate any support we get from our community. We want to keep it as easy as possible for you to contribute changes that make dicognito better for you. There are a few guidelines that we need contributors to follow so that we can all work together happily.

Preparation

Before starting work on a functional change, like a new feature, a change to an existing feature, or a bug fix, please ensure an issue has been raised. Indicate your intention to work on the issue by writing a comment against it. This will prevent duplication of effort. If the change is non-trivial, it's usually best to propose a design in the issue comments.

It is not necessary to raise an issue for non-functional changes such as refactoring, adding tests, reformatting code, documentation, updating packages, etc.

Tests

Changes in functionality (new features, changed behavior, or bug fixes) should be described by new or updated tests.

Style

We use Ruff as linter and formatter. Please follow existing conventions. Any deviations will cause the build to fail.

Making Changes

Dicognito uses the git branching model known as GitHub flow. As such, all development must be performed on a "feature branch" created from the main development branch, which is called main. To submit a change:

  1. Fork the dicognito repository on GitHub
  2. Clone your fork locally
  3. Configure the upstream repo (git remote add upstream git://github.com/blairconrad/dicognito.git)
  4. Create a local branch (git checkout -b my-branch main)
  5. Work on your feature
  6. Rebase if required (see "Handling Updates from upstream/main" below)
  7. Ensure the build and tests succeed (see "How to build")
  8. Push the branch up to GitHub (git push origin my-branch)
  9. Send a pull request on GitHub

You should never work directly on the main branch and you should never send a pull request from the main branch - always from a feature branch.

Handling Updates from upstream/main

While you're working away in your branch it's quite possible that your upstream/main (most likely the canonical dicognito version) may be updated. If this happens you should:

  1. Stash any un-committed changes you need to
  2. git checkout main
  3. git pull upstream main
  4. git checkout my-branch
  5. git rebase main my-branch
  6. git push origin main - (optional) this makes sure your remote main branch is up to date
  7. if you previously pushed your branch to your origin, you need to force push the rebased branch - git push origin my-branch --force-with-lease

This ensures that your history is "clean". That is, you have one branch off from main followed by your changes in a straight line. Failing to do this ends up with several "messy" merges in your history, which we don't want. This is the reason why you should always work in a branch and you should never be working in, or sending pull requests from, main.

If you're working on a long-running change then you may want to do this quite often, rather than run the risk of potential large merge conflicts further down the line.

Sending a Pull Request

While working on your feature you may well create several branches, which is fine, but before you send a pull request you should ensure that you have rebased back to a single feature branch. We care about your commits and we care about your feature branch but we don't care about how many or which branches you created while you were working on it. 😄

When you're ready to go you should confirm that you are up to date and rebased with upstream/main (see "Handling Updates from upstream/main" above) and then:

  1. git push origin my-branch
  2. Send a pull request in GitHub, selecting the following dropdown values:
Dropdown Value
base fork blairconrad/dicognito
base main
head fork {your fork} (e.g. {your username}/dicognito)
compare my-branch

The pull request should include a description starting with "Fixes #12345." (using the real issue number, of course) if it fixes an issue. If there's no issue, be sure to clearly explain the intent of the change.