Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotless java #4

Merged
merged 3 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 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