|
| 1 | +# General guidelines |
| 2 | + |
| 3 | +For your contributions, please follow the guidelines laid out below to the best |
| 4 | +of your ability. |
| 5 | + |
| 6 | +??? note "Beginners" |
| 7 | + |
| 8 | + If you don't have a lot of experience with this sort of workflow, the |
| 9 | + guidelines in this section may seem overwhelming. But please don't worry! |
| 10 | + We will guide you through the process and you will soon get the hang of it. |
| 11 | + And please don't worry about making mistakes either - everybody does them. |
| 12 | + Often! Our project layout makes it very very hard for anyone to cause |
| 13 | + irreversible harm, so relax, try things out, take your time and enjoy the |
| 14 | + work! :) |
| 15 | + |
| 16 | +## Communication |
| 17 | + |
| 18 | +Please use the comment functions available on GitHub to discuss issues and |
| 19 | +pull requests. For all other communications please refer to the communication |
| 20 | +channels listed in the [contact](../../about/contact.md) section. In |
| 21 | +particular, use the [chat][elixir-cloud-aai-slack] to discuss project ideas, |
| 22 | +get help on a problem, or any other informal discussion that does not need to |
| 23 | +be preserved as part of the repository you are working on. |
| 24 | + |
| 25 | +## Submitting issues |
| 26 | + |
| 27 | +Please use each project's GitHub issue tracker to: |
| 28 | + |
| 29 | +- propose features |
| 30 | +- report bugs |
| 31 | +- find issues to work on |
| 32 | +- discuss existing issues |
| 33 | + |
| 34 | +As an example, you can find this project's issue tracker |
| 35 | +[here][issue-tracker-example]. |
| 36 | + |
| 37 | +When submitting new issues to propose features or report bugs, please choose |
| 38 | +the most appropriate template, if available, then follow the instructions in |
| 39 | +the template. |
| 40 | + |
| 41 | +You don't need to add labels or milestones for an issue, the project |
| 42 | +maintainers will do that for you. However, it is important that all issues are |
| 43 | +written concisely, yet with enough detail and relevant context (links, |
| 44 | +screenshots, etc.) to allow others to start working on them. For bug reports, |
| 45 | +it is essential that they include reproducible examples. |
| 46 | + |
| 47 | +[Here][good-issues] and [here][good-bug-reports] are some resources to help you |
| 48 | +get started on writing good issues. |
| 49 | + |
| 50 | +## Branching model |
| 51 | + |
| 52 | +All of our projects are version-controlled via [Git][git] and codebases are |
| 53 | +hosted on [GitHub][github]. Please refer to appropriate documentation and |
| 54 | +tutorials if you are not familiar with them. |
| 55 | + |
| 56 | +To keep track our project histories clean, we follow a slightly modified |
| 57 | +version of the [GitHub Flow][github-flow] Branching model. What this means is |
| 58 | +that code changes are always merged into protected branches via pull requests |
| 59 | +that will undergo one or more rounds of review and testing. The schema below |
| 60 | +visualizes this process. |
| 61 | + |
| 62 | +[][github-flow] |
| 63 | + |
| 64 | +1. [Create a "feature branch"][git-branch] from the `dev` branch; use the |
| 65 | + `feature/my-feature` naming pattern to name your feature branch, e.g., |
| 66 | + `feature/update-docs`; make sure the `dev` [branch |
| 67 | + is up to date][git-pull] before creating the feature branch! |
| 68 | +2. [Commit code changes][git-commit] to address the issue you are working on |
| 69 | +3. [Push the feature branch][git-push] to the remote and [create a pull |
| 70 | + request][github-pr] in GitHub |
| 71 | +4. Address any comments added during code review by pushing additional commits |
| 72 | + (there may be multiple rounds of reviews) |
| 73 | +5. Once all issues are resolved, code owners will merge the feature branch into |
| 74 | + the `dev` branch using the ["squash merging"][github-merge-squash] method |
| 75 | + |
| 76 | +!!! note "Default branch" |
| 77 | + |
| 78 | + `dev` is the default branch for all projects in pre-release state, i.e., |
| 79 | + those with version numbers below `v1.0.0`. Upon release, `main` becomes |
| 80 | + the default branch, and [semantic versioning][sem-ver] is strictly adhered |
| 81 | + by. |
| 82 | + |
| 83 | +??? note "Substantial changes" |
| 84 | + |
| 85 | + If your proposed changes will be substantial, try to split up the work into |
| 86 | + multiple feature branches. This makes reviewing easier, helps to keep the |
| 87 | + project history clean and may better guard against code regression. A rule |
| 88 | + of thumb is that you should be able to adequately summarize your changes |
| 89 | + with 50 characters. |
| 90 | + |
| 91 | + If your changes are becoming more substantial than you anticipated, you can |
| 92 | + request that the branch be ["rebase merged"][github-merge-rebase] instead |
| 93 | + of ["squash merged"][github-merge-squash]. However, we will only do so if |
| 94 | + you have exactly one clean commit for each semantic work package and each |
| 95 | + commit message follows the conventional commit specifications. You can use |
| 96 | + [`git rebase --interactive`][git-rebase] to clean up your feature branch. |
| 97 | + |
| 98 | +??? warning "Feature branches unstable" |
| 99 | + |
| 100 | + All feature branches are to be considered unstable, i.e., their history may |
| 101 | + change at any time, even after being pushed to the remote. Therefore, do |
| 102 | + **not** work on feature branches without clearly communicating with the |
| 103 | + people who have created them. |
| 104 | + |
| 105 | +## Commit messages |
| 106 | + |
| 107 | +Generally, no specific formatting of individual commit messages is required when |
| 108 | +working on _feature branches_. However, your **pull request titles MUST follow |
| 109 | +the [Conventional Commits specification][conv-commits]**. The same is true for |
| 110 | +individual commit messages if you are requesting that your feature branch be |
| 111 | +"rebase merged" (see info box "Substantial changes" above). |
| 112 | + |
| 113 | +[Conventional Commits][conv-commits] help to increase consistency, facilitate |
| 114 | +maintenance and enable automated versioning and change log generation. Their |
| 115 | +general structure is as follows: |
| 116 | + |
| 117 | +```console |
| 118 | +<type>(optional scope): <description> |
| 119 | + |
| 120 | +[optional body] |
| 121 | + |
| 122 | +[optional footer] |
| 123 | +``` |
| 124 | + |
| 125 | +Please follow these rules for your commit messages / PR titles: |
| 126 | + |
| 127 | +- Keep your entire header/title line (including type and, if available, scope) |
| 128 | + at **50 characters or less** |
| 129 | +- Only use the types listed in the table below; choose the type according to the |
| 130 | + predominant reason for the change |
| 131 | +- Only use types `feat`, `fix`, `perf`, `refactor` and `style` for changes in |
| 132 | + package/production code; use the dedicated types for all build-, CI-, |
| 133 | + documentation- or test-related changes |
| 134 | +- Indicating a scope is optional; it is only necessary if scopes are generally |
| 135 | + used in the repository you are working on |
| 136 | +- Start the `<description>` with a verb in imperative form (e.g., `add`, `fix`) |
| 137 | +- If you include a body and/or footer, make sure it conforms to the |
| 138 | + Conventional Commits specification |
| 139 | + |
| 140 | +Depending on the changes, we would kindly request you to use one of the |
| 141 | +following **type** prefixes: |
| 142 | + |
| 143 | +| Type | Description | |
| 144 | +| --- | --- | |
| 145 | +| build | For changes related to the build system (e.g., scripts, configurations and tools) and package dependencies | |
| 146 | +| chore | For changes related to mundane repository maintenance tasks that are not covered by any of the other types (e.g., adding a `.gitignore file) | |
| 147 | +| ci | For changes related to the continuous integration and deployment system (e.g., workflows, scripts, configurations and tools) | |
| 148 | +| docs | For changes related to the project documentation, regardless of the audience (end users, developers) | |
| 149 | +| feat | For changes related to new abilities or functionality | |
| 150 | +| fix | For changes related to bug fixes | |
| 151 | +| perf | For changes related to performance improvements | |
| 152 | +| refactor | For changes related to modifying the codebase, which neither adds a feature nor fixes a bug (e.g., removing redundant code, simplifying code, renaming variables) | |
| 153 | +| revert | For changes that revert one or more previous commits | |
| 154 | +| style | For changes related to styling the codebase (e.g., indentation, parentheses/brackets, white space, trailing commas) | |
| 155 | +| test | For changes related to tests | |
| 156 | + |
| 157 | +!!! info "Linting commit messages" |
| 158 | + |
| 159 | + In order to ensure that the format of your commit messages adheres to the |
| 160 | + Conventional Commits specification and the defined type vocabulary, you can |
| 161 | + use a [dedicated linter][conv-commits-lint]. More information can also be |
| 162 | + found in this [blog post][conv-commits-blog]. |
| 163 | + |
| 164 | +## Filing pull requests |
| 165 | + |
| 166 | +Open pull requests through the GitHub interface, VS Code or your favorite Git |
| 167 | +client. Make sure to follow the branching model. Most importantly: |
| 168 | + |
| 169 | +??? warning "Use Conventional Commit messages for your PR titles!" |
| 170 | + |
| 171 | + See details in the [commit message](#commit-messages) section. |
| 172 | + |
| 173 | +### Code reviews |
| 174 | + |
| 175 | +All code changes are reviewed by at least one other person. This is to ensure |
| 176 | +that the code is of high quality, that it is well-documented and that it adheres |
| 177 | +to the project's coding standards. The reviewer will check that the code is |
| 178 | +correct, that it is efficient and that it is maintainable. They will also check |
| 179 | +that the code is well-documented and that it is tested. |
| 180 | + |
| 181 | +Please make sure to actively request reviews for your pull requests to avoid |
| 182 | +delays in the review and merging process. Please use the GitHub functionality |
| 183 | +for that (upper right hand corner of pull request view). If you are unsure who |
| 184 | +to ask for a review, please reach out to the project leads. |
| 185 | + |
| 186 | +### Pull request template |
| 187 | + |
| 188 | +The following pull request template will be successively added to all |
| 189 | +repositories. Until that is the case, you can already make use of it by |
| 190 | +self-reviewing your pull requests according to the checklist and descriptions. |
| 191 | + |
| 192 | +#### Description |
| 193 | + |
| 194 | +> Please include a summary of the change and the relevant issue(s) it resolves, |
| 195 | +> if any (otherwise delete that line), e.g., `Fixes #123`. If the PR addresses |
| 196 | +> more than one issue, please add multiple lines, each starting with 'Fixes #'. |
| 197 | +> Please stick to that syntax precisely, including whitespaces, otherwise the |
| 198 | +> issue(s) may not be linked to the PR. |
| 199 | +> |
| 200 | +> In the summary, list any dependencies that are required for this change. |
| 201 | +> Please use bullet points for the description. Please also briefly describe |
| 202 | +> the relevant motivation and context briefly. For very trivial changes that are |
| 203 | +> duly explained by the PR title, a description can be omitted. |
| 204 | +
|
| 205 | +- |
| 206 | + |
| 207 | +Fixes #(issue number) |
| 208 | + |
| 209 | +#### Checklist |
| 210 | + |
| 211 | +> Please go through the following checklist to ensure that your change is ready |
| 212 | +> for review. Please do not forget to double check the list after you have |
| 213 | +> modified your PR, e.g., if you have added commits to address reviewer |
| 214 | +> comments or to fix failing automated checks. **Please check items also if they |
| 215 | +> do not apply to your change**, e.g., if your change does not require an update |
| 216 | +> of the user-facing documentation, still check the box. |
| 217 | +> |
| 218 | +> Generally, **PRs are only reviewed when all boxes are ticked off and all |
| 219 | +> automated checks pass** (use the comment section below if you believe that |
| 220 | +> your PR is ready to be merged even though not all boxes were ticked off). |
| 221 | +
|
| 222 | +- [ ] My code follows the [contributing guidelines](workflow.md) of this |
| 223 | + project, including, in particular, with regard to any style guidelines |
| 224 | +- [ ] The title of my PR complies with the [Conventional Commits |
| 225 | + specification][conv-commits]; in particular, it clearly indicates |
| 226 | + that a change is a breaking change |
| 227 | +- [ ] I acknowledge that all my commits will be squashed into a single commit, |
| 228 | + using the PR title as the commit message |
| 229 | +- [ ] I have performed a self-review of my own code |
| 230 | +- [ ] I have commented my code in hard-to-understand areas |
| 231 | +- [ ] I have updated the user-facing documentation to describe any new or |
| 232 | + changed behavior |
| 233 | +- [ ] I have added type annotations for all function/class/method interfaces |
| 234 | + or updated existing ones (only for Python, TypeScript, etc.) |
| 235 | +- [ ] I have provided appropriate documentation (e.g., [Google-style |
| 236 | + Python docstrings][py-doc-google] or [JSDoc block tags][jsdoc]) for all |
| 237 | + packages/modules/functions/classes/methods or updated existing ones |
| 238 | +- [ ] My changes generate no new warnings |
| 239 | +- [ ] I have added tests that prove my fix is effective or that my feature |
| 240 | + works |
| 241 | +- [ ] New and existing unit tests pass locally with my changes |
| 242 | +- [ ] I have not reduced the existing code coverage |
| 243 | +- [ ] I have asked the [@all-contributors bot][all-contributors-bot] to |
| 244 | + acknowledge my contributions by commenting on this PR with a request of |
| 245 | + the form `@all-contributors please add @YOUR_GH_HANDLE for TYPE_1, |
| 246 | + TYPE_2, ...`, where `TYPE_1` etc. refer to [contribution types supported |
| 247 | + by the All Contributors Specification][all-contributors-types] OR I do |
| 248 | + not want my contributions to be acknowledged by [All |
| 249 | + Contributors][all-contributors] |
| 250 | + |
| 251 | +!!! note "All Contributors" |
| 252 | + |
| 253 | + The [All Contributors][all-contributors] bot may not be available in all |
| 254 | + repositories yet. In that case, please ignore the last bullet point. |
| 255 | + |
| 256 | +#### Comments |
| 257 | + |
| 258 | +> If there are unchecked boxes in the list above, but you would still like your |
| 259 | +> PR to be reviewed or considered for merging, please describe here why boxes |
| 260 | +> were not checked. For example, if you are positive that your commits should |
| 261 | +> _not_ be squased when merging, please explain why you think the PR warrants |
| 262 | +> or requires multiple commits to be added to the history (but note that in |
| 263 | +> that case, it is a prerequisite that all commits follow the Conventional |
| 264 | +> Commits specification). |
0 commit comments