|
| 1 | +## Development rules: |
| 2 | + |
| 3 | +- Use `Lombok` |
| 4 | +- Only Use Data Transfer Objects (Dto's) for request/response data (e.g. create a `dtos` package (do not put this package into the `models` package). |
| 5 | +- Make *everything* configurable (e.g. via values in `.env` and `application.properties`), i.e. no constant value should be hard-coded. The database credentials are already pre-configured this way. |
| 6 | +- Unit tests should be a part of pull requests |
| 7 | +- Use the object wrapper for primitive types, e.g. `Long` instead of `long` |
| 8 | +- Naming |
| 9 | + - Entities/Models |
| 10 | + - Use camelCase for Java properties and snake_case for the corresponding database column names. For example `private String activationToken` in the User model should be mapped to the `activation_token` column in the `users` table |
| 11 | + - Database: |
| 12 | + - Use plurals for database tables, e.g. `users`, `posts`, `likes` (and singular for the corresponding models names, i.e. `User`, `Post`, `Like`) |
| 13 | + - Use `@GeneratedValue(strategy = GenerationType.IDENTITY)` for auto-incremented fields |
| 14 | + - Tests: use descriptive (test) method names (to improve readability): |
| 15 | + - : `canCreateModel()` |
| 16 | + - : `isEmptyIsFalseForReceiptWithItems()` |
| 17 | + - : `canAddPermissionsToUsers()` |
| 18 | + - Endpoints: always start with `/api/v1/` |
| 19 | + - Endpoints: use all lowercase letters and '-' for spaces |
| 20 | + - : `/api/v1/user/vouchers` |
| 21 | + - : `/api/v1/forgot-password` |
| 22 | + - Create descriptive branch names, e.g. feature-user-registration |
| 23 | +- Use `this` keyword only to avoid variable name conflicts |
| 24 | +- Use the [code formatting](https://blog.jetbrains.com/idea/2020/06/code-formatting/) feature in Intellij (CTRL+ALT+L / ⌥⌘L) |
| 25 | +- Have at least 90% test coverage regarding services (unit test) and controllers (integration tests) |
| 26 | +- Use [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) |
| 27 | + - Have a look [here](https://stackoverflow.com/questions/42979700/how-to-configure-google-java-code-formatter-in-intellij-idea-17) on how to configure the google java style guides in IntelliJ |
| 28 | + - Make sure to use braces {} with `if`, `else`, `for`, `do` and `while` statements, even when the body is empty or contains only a single statement. |
| 29 | + |
| 30 | + |
| 31 | +## Processes: |
| 32 | +- Push only when *all* tests and style checks have passed |
| 33 | +- Make sure there are no unresolved conflicts esp. in other than .java files |
| 34 | +- see [CONTRIBUTING](CONTRIBUTING.md) |
| 35 | + |
| 36 | +## Useful links |
| 37 | + |
| 38 | +Contributing: |
| 39 | + |
| 40 | +- see [CONTRIBUTING](CONTRIBUTING.md) |
| 41 | + |
| 42 | +Commit messages: |
| 43 | + |
| 44 | +- https://chris.beams.io/posts/git-commit/ |
| 45 | + |
| 46 | +Git cheat sheet |
| 47 | + |
| 48 | +https://docs.google.com/spreadsheets/d/1Y6ylJLSbkUqLzn9kN_rQSgDlssRpR-ZFresF46apFWY/edit?usp=sharing |
| 49 | + |
| 50 | +## Git Workflow |
| 51 | + |
| 52 | +See [CONTRIBUTING](CONTRIBUTING.md) |
0 commit comments