CONTRIBUTING.md 3.68 KB
Newer Older
1 2
# Contributing

3 4 5
We would love for you to contribute to the backoffice of [Code du travail numérique][link-cdtn] and
help make it even better than it is today! As a contributor, here are the guidelines we would like
you to follow:
6

7 8 9 10 11 12 13 14 15 16 17 18 19 20
- [Contributing](#contributing)
  - [Code Naming Guidelines](#code-naming-guidelines)
    - [API-related Actions](#api-related-actions)
    - [React Component Actions](#react-component-actions)
  - [Commit Message Guidelines](#commit-message-guidelines)
    - [Revert](#revert)
    - [Type](#type)
    - [Scope](#scope)
    - [Subject](#subject)

## Code Naming Guidelines

### API-related Actions

21
This includes react components methods as well as redux actions, action types and sagas:
22 23 24 25

- Any `GET` call-related method should start with the verb **load**.
- Any `POST` call-related method should start with the verb **create**.
- Any `PATCH` call-related method should start with the verb **update**.
26
- Any `DELETE` call-related method should start with the verb **delete** (or **\_delete**).
27 28 29 30

### React Component Actions

- Any method generating components should start with the verb **render**.
31 32 33 34 35 36 37 38 39 40 41

## Commit Message Guidelines

Each commit message consists of a **type**, a **scope** and a **subject**:

```
<type>(<scope>): <subject>
```

The **type** is mandatory and the **scope** of the header is optional.

42 43
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
to read on GitHub as well as in various git tools.
44 45 46 47 48 49 50

**Examples:**

- `docs(changelog): update changelog to 1.12.5`
- `fix(release): need to depend on latest rxjs and zone.js`
- `ci: configure dependabot`

51
Do not hesitate check [existing commits][link-cdtb-commits] to get a better understanding.
52 53 54

### Revert

55 56 57
If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of
the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the
SHA of the commit being reverted.
58 59 60 61 62 63

### Type

Must be one of the following:

- **build**: Changes that affect the build system or external dependencies.
64
- **chore**: Updates and upgrades.
65 66 67 68 69 70 71 72 73 74 75
- **ci**: Changes to our CI configuration files and scripts.
- **docs**: Documentation only changes.
- **feat**: A new feature.
- **fix**: A bug fix.
- **perf**: A code change that improves performance.
- **refactor**: A code change that neither fixes a bug nor adds a feature.
- **style**: Changes that do not affect the meaning of the code.
- **test**: Adding missing tests or correcting existing tests.

### Scope

76 77
The scope should be the name of the npm package affected (as perceived by the person reading the
changelog generated from commit messages.
78 79 80 81

The following is the list of supported scopes:

- **api**
82
- **db**
83 84 85 86 87
- **admin**
- **contrib**

There are currently a few exceptions to the "use package name" rule:

88 89 90
- **packaging**: Used for changes that change the npm package layout in all of our packages, e.g.
  public path changes, package.json changes done to all packages, d.ts file/format changes, changes
  to bundles, etc.
91
- **changelog**: Used for updating the release notes in CHANGELOG.md
92 93 94
- none/empty string: useful for `style`, `test` and `refactor` changes that are done across all
  packages (e.g. `style: add missing semicolons`) and for docs changes that are not related to a
  specific package (e.g. `docs: fix typo in tutorial`).
95 96 97 98 99 100 101 102 103 104 105

### Subject

The subject contains a succinct description of the change:

- Use the imperative, present tense: "change" not "changed" nor "changes".
- Don't capitalize the first letter.
- No dot (.) at the end.

---

106
[link-cdtb-commits]: https://github.com/SocialGouv/code-du-travail-backoffice/commits/master
107
[link-cdtn]: https://codedutravail.num.social.gouv.fr