|
1 |
| -# Contributing code to famedly talk |
| 1 | +# Contributing code to Famedly |
2 | 2 |
|
3 |
| -Everyone is welcome to contribute code to FamedlySDK, provided that they are willing to license their contributions under the same license as the project itself. |
4 |
| -Please follow these rules when contributing code to famedly talk: |
| 3 | +*See also: Code of Conduct* |
5 | 4 |
|
6 |
| -## Merge Requests: |
7 |
| -- Never ever just push something directly to the master branch! |
8 |
| -- Create a new branch or fork this project and send a Merge Request. |
9 |
| -- Only Merge Requests with a working CI can be merged. |
10 |
| -- Only Merge Requests with at least one code reviewer can be merged. |
11 |
| -- Merge Requests may be refused if they don't follow the rules below. |
12 |
| -- A new Merge Request SHOULD never decrease the test coverage. |
| 5 | +We look forward to you joining our team. Everyone is welcome to contribute code via pull requests or to file issues on Gitlab or help other peoples. We communicate primarily over Gitlab and on chat channels. You should be willing to license your contributions under the same license as the project itself. |
13 | 6 |
|
14 |
| -## Branches |
15 |
| -### Naming |
| 7 | +# How to contribute |
| 8 | +The only way to contribute changes to our project is to create a new branch or to fork it on Gitlab. Then create a merge request to ask us to merge your changes into the main branch of our repository. (https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html) |
16 | 9 |
|
17 |
| -Branches should get named by this pattern: `[Module Name]-[Type]-[Detail]`. |
| 10 | +**The main branch is our development branch where all the work happens.** |
18 | 11 |
|
19 |
| -That means for example: "users-fix-attach-roles-issue#765". |
| 12 | +## Merge request workflow in detail |
| 13 | +- Create a new branch or fork the main branch of the project (Please follow the guidlines below of naming branch and commits) |
| 14 | +- Make a merge request to merge your changes into the main branch |
| 15 | +- We use the Gitlab merge request workflow to review your contribution |
| 16 | + - Only merge requests with a working CI can be merged |
| 17 | + - Only merge requests with at least one code reviewer of the core team can be merged |
| 18 | + - Only merge requests which are signed-off can be merged |
| 19 | +- Merge Requests may be refused if they don't follow the rules below. |
20 | 20 |
|
21 |
| -Modules are various parts of the App. This can for example be the directory list or the chat room. |
| 21 | +**Never ever just push something directly to the main branch!** |
22 | 22 |
|
23 |
| -Types can be one of these: |
24 |
| -- **feature** |
25 |
| -- **enhance** |
26 |
| -- **cleanup** |
27 |
| -- **refactor** |
28 |
| -- **fix** |
29 |
| -- **hotfix** (should rarely get used) |
| 23 | +## Naming guidelines & code style |
30 | 24 |
|
31 |
| -The Detail part of the pattern should be a short description of what the branch delivers. |
| 25 | +### Create a branch |
32 | 26 |
|
33 |
| -## Commit Messages |
| 27 | +- Branches should get named by this pattern: `username/name-your-changes`. |
34 | 28 |
|
35 |
| -Commit Messages should get written in this pattern: `[[Module Name]] [Commit Message]`. |
36 |
| -That means for example: "[users] add fetch users endpoint". |
| 29 | +*That means for example: "alice/fix-this-bug".* |
37 | 30 |
|
| 31 | +- Use [Conventional Commits](https://www.conventionalcommits.org/) |
38 | 32 |
|
39 |
| -## File structure: |
40 |
| -- Every file must be named by the class and must be capitalized in the beginning. |
| 33 | +### File structure: |
| 34 | +- File names must be `snake_case`. |
41 | 35 | - Directories need to be lowercase.
|
42 | 36 |
|
43 |
| -## Code style: |
44 |
| -Please use code formatting. You can use VSCode or Android Studio. On other editors you need to run: |
45 |
| -``` |
46 |
| -flutter format lib/**/*/*.dart |
47 |
| -``` |
| 37 | +### Code style: |
| 38 | +- We recommend using Android Studio or VS Code for coding |
| 39 | +- Follow the common Dart style in: https://dart.dev/guides/language/effective-dart/style |
| 40 | +- Format the code with `flutter format lib` - otherwise the CI will fail |
48 | 41 |
|
49 |
| -## Code quality: |
| 42 | +### Code quality |
50 | 43 | - Don't repeat yourself! Use local variables, functions, classes.
|
51 | 44 | - Don't mix UI and business logic in the same environment.
|
52 | 45 | - Write tests for new classes, functions and widgets.
|
53 | 46 | - Keep it simple stupid: https://en.wikipedia.org/wiki/KISS_principle
|
54 |
| -- Describe all of your classes, methods and attributes using **dartdoc** comments. Read this for more informations: https://dart.dev/guides/language/effective-dart/documentation |
| 47 | +- Describe all of your classes, methods and attributes using **dartdoc** comments. Read this for more information: https://dart.dev/guides/language/effective-dart/documentation |
| 48 | +- Don't write functions to create new widgets. Write classes! |
| 49 | +- Don't insert unlocalized strings! |
| 50 | +- Use Dart extensions to extend class functionality instead of writing wrapper classes! |
| 51 | +- Don't mix functions which changes the state of something (functions with a return type of `void` or `Future<void>`) and functional programming which doesn't. |
| 52 | + |
| 53 | +## Sign off |
| 54 | +In order to have a concrete record that your contribution is intentional and you agree to license it under the same terms as the project's license, we've adopted the same lightweight approach that [the Linux Kernel](https://www.kernel.org/doc/Documentation/SubmittingPatches), [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other projects use: the [**DCO - Developer Certificate of Origin**](http://developercertificate.org/). This is a simple declaration that you wrote the contribution or otherwise have the right to contribute it to Matrix: |
| 55 | + |
| 56 | +``` |
| 57 | +Developer Certificate of Origin |
| 58 | +Version 1.1 |
| 59 | +
|
| 60 | +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. |
| 61 | +660 York Street, Suite 102, |
| 62 | +San Francisco, CA 94110 USA |
| 63 | +
|
| 64 | +Everyone is permitted to copy and distribute verbatim copies of this |
| 65 | +license document, but changing it is not allowed. |
| 66 | +
|
| 67 | +Developer's Certificate of Origin 1.1 |
| 68 | +
|
| 69 | +By making a contribution to this project, I certify that: |
| 70 | +
|
| 71 | +(a) The contribution was created in whole or in part by me and I |
| 72 | + have the right to submit it under the open source license |
| 73 | + indicated in the file; or |
| 74 | +
|
| 75 | +(b) The contribution is based upon previous work that, to the best |
| 76 | + of my knowledge, is covered under an appropriate open source |
| 77 | + license and I have the right under that license to submit that |
| 78 | + work with modifications, whether created in whole or in part |
| 79 | + by me, under the same open source license (unless I am |
| 80 | + permitted to submit under a different license), as indicated |
| 81 | + in the file; or |
| 82 | +
|
| 83 | +(c) The contribution was provided directly to me by some other |
| 84 | + person who certified (a), (b) or (c) and I have not modified |
| 85 | + it. |
| 86 | +
|
| 87 | +(d) I understand and agree that this project and the contribution |
| 88 | + are public and that a record of the contribution (including all |
| 89 | + personal information I submit with it, including my sign-off) is |
| 90 | + maintained indefinitely and may be redistributed consistent with |
| 91 | + this project or the open source license(s) involved. |
| 92 | +``` |
| 93 | + |
| 94 | +If you agree to this for your contribution, then all that's needed is to include the line in your commit or merge request comment: |
| 95 | + |
| 96 | +`Signed-off-by: Your Name <your@email.example.org>` |
| 97 | + |
| 98 | +We accept contributions under a legally identifiable name, such as your name on government documentation or common-law names (names claimed by legitimate usage or repute). Unfortunately, we cannot accept anonymous contributions at this time. |
| 99 | + |
| 100 | +Git allows you to add this signoff automatically when using the `-s` flag to `git commit`, which uses the name and email set in your `user.name` and `user.email` git configs. |
| 101 | + |
| 102 | +If you forgot to sign off your commits before making your pull request and are on Git 2.17+ you can mass signoff using rebase: |
| 103 | + |
| 104 | +`git rebase --signoff origin/main` |
0 commit comments