Skip to content

Commit

Permalink
Merge pull request #4 from SwevenSoftware/feature/spotless-gradle
Browse files Browse the repository at this point in the history
Spotless java
  • Loading branch information
lusergit authored Feb 17, 2021
2 parents 7eb4c11 + e4c3c34 commit 1184e47
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 15
uses: actions/setup-java@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# BlockCOVID-server
Modulo Server per il progetto di SWE 2020/2021 - BlockCOVID

## Pre-Commit
Eseguire il seguente comando per salvare il git hook:
``` bash
ln -s pre-commit.sh .git/hooks/pre-commit
```

## Come usare mongo
Sono inclusi degli script per utilizzare mongo per testare come si comporta:
- **Avvio**: `./spawnMongo.sh`, spawna un'istanza di `mongod` che lavora sulla cartella locale `./db` e raccoglie i log nel file `log`. Fallisce se ci sono altre istanze già attive.
Expand Down
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id 'com.diffplug.spotless' version '5.6.1'
id 'org.springframework.boot' version '2.4.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
Expand Down Expand Up @@ -30,3 +31,15 @@ dependencies {
test {
useJUnitPlatform()
}

spotless {
ratchetFrom 'origin/develop'
java {
toggleOffOn()

importOrder()
removeUnusedImports()

googleJavaFormat()
}
}
8 changes: 8 additions & 0 deletions pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
RED='\033[1;31m'
NC='\033[0m'
if !(./gradlew spotlessCheck) >/dev/null 2>&1
then
echo "${RED}Spotless error:${NC} please run './gradlew spotlessApply'" 1>&2
exit 1
fi

0 comments on commit 1184e47

Please sign in to comment.