RAPPEL : Opération de maintenance > ForgeMIA indisponible le 20 Janvier entre 7h et 12h

CONTRIBUTING.md 3.96 KB
Newer Older
1
# How to contribute to FAIDARE
Raphaël Flores's avatar
Raphaël Flores committed
2

Célia Michotey's avatar
Célia Michotey committed
3
[[_TOC_]]
Raphaël Flores's avatar
Typo    
Raphaël Flores committed
4

Raphaël Flores's avatar
Raphaël Flores committed
5
6
7
8
## Git management

### Branches

Raphaël Flores's avatar
Raphaël Flores committed
9
* One stable & protected [master](/) branch
Raphaël Flores's avatar
Raphaël Flores committed
10
* Feature branches for development following the pattern `[dev_type]/[dev_name]` (ie. `chore/explaining_how_to_merge`) where `[dev_type]` can be:
11
12
13
14
15
16
  * fix (bug fixes)
  * feat (new feature)
  * style (style modification)
  * refactor (code refactoring)
  * chore (base maintenance such as version bump)
  * test (for anything related to tests)
Raphaël Flores's avatar
Raphaël Flores committed
17
18

### Commit & branches merge
19

Raphaël Flores's avatar
Raphaël Flores committed
20
21
* Commit name should follow pattern `[dev_type]: [brief description of the commit, lower than 50 characters]. [JIRA-KEY]`
* All branches must be merged via a `merge request` (MR)
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
* Merge requests should be created at the time of the branch creation in order to allow reviewer to comment and follow the developments, specify the `WIP` tag in the MR name (go further: *[feature highlight WIP](https://about.gitlab.com/2016/01/08/feature-highlight-wip/)*). Example:

  ```sh
  git checkout -b chore/explaining_how_to_merge
  git push --set-upstram origin chore/explaining_how_to_merge
  ```

  Returns a link for creating the merge request easily:

  ```sh
  Total 0 (delta 0), reused 0 (delta 0)
  remote:
  remote: To create a merge request for chore/explaining_how_to_merge, visit:
  remote:   https://forgemia.inra.fr/urgi-is/faidare/merge_requests/new?merge_request%5Bsource_branch%5D=chore/explaining_how_to_merge
  remote:
  To forgemia.inra.fr:urgi-is/faidare.git
  * [new branch]      chore/explaining_how_to_merge -> chore/explaining_how_to_merge
  La branche 'chore/explaining_how_to_merge' est paramétrée pour suivre la branche distante 'chore/explaining_how_to_merge' depuis 'origin'.
  ```
Raphaël Flores's avatar
Raphaël Flores committed
41
42

* A `git rebase` is strongly recommanded before merging a MR
43
44
  * [Git rebase official documentation](https://git-scm.com/book/en/v2/Git-Branching-Rebasing)
  * [How to keep a clean history](https://about.gitlab.com/2018/06/07/keeping-git-commit-history-clean/)
Raphaël Flores's avatar
Raphaël Flores committed
45
46
47
48
* Merge requests should be reviewed by at least 2 colleagues
* Continuous Integration is launched automatically by Gitlab on each commit push or merge request creation.

## Data management
49

Raphaël Flores's avatar
Raphaël Flores committed
50
* Git LFS (look at [how to install](https://git-lfs.github.com/)) feature is enabled on this project in order to store JSON test data
Raphaël Flores's avatar
Raphaël Flores committed
51
* Another dedicated Git LFS project (internal only) will be created to handle all private + public JSON files
Raphaël Flores's avatar
Raphaël Flores committed
52
* **TODO**: refer to the good Git LFS project in the CI settings for indexing the relevant data into the relevant Elasticsearch indices/instances
Raphaël Flores's avatar
Raphaël Flores committed
53
54
55
* the JSON files generation will be handled by an external ET (extract/transform) tool.

## Development environment
56

Raphaël Flores's avatar
Raphaël Flores committed
57
58
59
* Look at the [README.md](README.md) for installation and execution instructions.
* Recommanded IDE is [Intellij IDEA](https://www.jetbrains.com/idea/)
* Use linting to apply code standards within the team:
60
61
  * Use `ng lint` (for frontend code only)
  * Use [Checkstyle](https://checkstyle.org/) and [PMD](https://pmd.github.io/) (**TODO**: implement) for backend (+frontend?) code
Raphaël Flores's avatar
Raphaël Flores committed
62
* All runtime variables should be externalized from the code in order to facilitate the CI management (database host/port, application name, public URL, JSON location...) and the adoption by partners
63
64
65
66
67
68
69
* Configure [Yelp's detect-secrets](https://github.com/Yelp/detect-secrets) pre-commit hook to track any high entropy strings, which could possibly be leaked secrets.
  * Run: `pip3 install pre-commit detect-secrets --user && pre-commit install` to configure you dev environment.
  * If a secret is detected:
    * either fix it (because it must not be committed)
    * or run:
      * `detect-secrets scan --update .secrets.baseline` to update the secret baseline, then
      * `detect-secrets audit .secrets.baseline` to tag it as a false positive if relevant.
70

Raphaël Flores's avatar
Raphaël Flores committed
71
## Testing recommendations
72

Raphaël Flores's avatar
Typo    
Raphaël Flores committed
73
Behaviour driven development (upon [TDD](https://dannorth.net/2012/05/31/bdd-is-like-tdd-if/)) is recommended for all new developments.
74
75

More information on what is BDD: <https://dannorth.net/introducing-bdd/>