add spotless

This commit is contained in:
Michael Hoennig 2022-08-04 09:41:27 +02:00
parent 8605d4c4f1
commit a2f2fdb6a4
6 changed files with 65 additions and 9 deletions

View File

@ -236,6 +236,54 @@ You can explore the prototype as follows:
- then run `historization.sql` in the database,
- finally run `examples.sql` in the database.
## Coding Guidelines
### Directory and Package Structure
Generally, the standard Java directory structure is used, where productive and test code are sparated like this:
```
src
main/
java/
net.hostsharing.hasadminng/
resources/
test/
java/
net.hostsharing.hasadminng/
resources/
```
The Java package structure below contains:
- config and global (utility) packages,
these should not access any other packages within the project
- rbac, containing all packages related to the RBAC subsystem
- hs, containing Hostsharing business object related packages
Underneath of rbac and hs, the structure is business oriented, NOT technical / layer -oriented.
Some of these rules are checked with *ArchUnit* unit tests.
### Spotless Code Formatting
Code formatting for Java is checked via *spotless*.
The formatting style can be checked with this command:
```shell
gw spotlessCheck
```
This task is also included in `gw build`.
To apply formatting rules, use:
```shell
gw spotlessApply
```
## How To
### How to Use a Persistent Database for Integration Tests?

10
TODO.md
View File

@ -23,13 +23,13 @@ This document is just for tracking the initial development project and thus only
| ID | Beschreibung | Budget | Aufwand | Leistung |
|:----|:-----------------------------------------------------------|---------:|--------:|---------:|
| DEV | Aufbau der Entwicklungsumgebung (bis inkl. Unit-Tests) | 16 | | |
| ATN | Entwurf des Authorisierungs-Systems | 40 | 100 | 36 |
| DEV | Aufbau der Entwicklungsumgebung (bis inkl. Unit-Tests) | 16 | 12 | 16 |
| ATN | Entwurf des Authorisierungs-Systems | 40 | 68 | 36 |
| ATZ | Auswahl und Implementierung des Authentifizierungs-Systems | 20 | | |
| ITS | Aufbau einer Umgebung für Integrationstests (*1) | 4 | 4 | 20 |
| ATS | Aufbau einer Umgebung für Akzeptanzteste (*1) | 16 | 3 | 4 |
| ITS | Aufbau einer Umgebung für Integrationstests (*1) | 4 | 4 | 4 |
| ATS | Aufbau einer Umgebung für Akzeptanztests (*1) | 16 | 3 | |
| PIP | Aufbau einer Build- und Testpipeline | 20 | | |
| ARC | Aufbau einer Architekturkontrolle | 8 | | |
| ARC | Aufbau einer Architekturkontrolle | 8 | 2 | 2 |
| | | | | |
(*1: ITS+ATS sind aufgesplittet aus TST mit 20 geplanten Stunden entstanden)

View File

@ -1,7 +1,8 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
id "com.diffplug.spotless" version "6.9.0"
}
group = 'net.hostsharing'
@ -22,6 +23,8 @@ ext {
set('testcontainersVersion', "1.17.3")
}
// wrapper
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
@ -55,3 +58,11 @@ dependencyManagement {
tasks.named('test') {
useJUnitPlatform()
}
spotless {
java {
removeUnusedImports()
endWithNewline()
toggleOffOn()
}
}

View File

@ -14,4 +14,3 @@ public interface RbacRoleRepository extends Repository<RbacRoleEntity, UUID> {
*/
List<RbacRoleEntity> findAll();
}

View File

@ -1,6 +1,5 @@
package net.hostsharing.hsadminng.hs.hscustomer;
import net.hostsharing.hsadminng.hs.hscustomer.CustomerEntity;
import static java.util.UUID.randomUUID;

View File

@ -1,7 +1,6 @@
package net.hostsharing.hsadminng.hs.hspackage;
import net.hostsharing.hsadminng.hs.hscustomer.CustomerEntity;
import net.hostsharing.hsadminng.hs.hspackage.PackageEntity;
import net.hostsharing.hsadminng.hs.hscustomer.TestCustomer;
import static java.util.UUID.randomUUID;