From 844870199e1e1fe420a61d9bc4fff75a2efdff26 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Thu, 8 Jun 2023 08:15:09 -0400 Subject: [PATCH 1/6] ci: add linting job --- .github/workflows/build.yml | 5 + .gitignore | 4 +- .vscode/code-style.xml | 337 ++++++++++++++++++++++++++++++++++++ pom.xml | 53 ++++-- 4 files changed, 383 insertions(+), 16 deletions(-) create mode 100644 .vscode/code-style.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1768f2ff..493522ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,15 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: java-version: '11' distribution: 'adopt' + + - name: Validate code format + run: mvn formatter:validate + - name: Build with Maven run: mvn -B package --file pom.xml diff --git a/.gitignore b/.gitignore index d5a7ca72..43e8b80c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /target/ .env /.idea/ -.vscode \ No newline at end of file +.vscode/* + +!.vscode/code-style.xml \ No newline at end of file diff --git a/.vscode/code-style.xml b/.vscode/code-style.xml new file mode 100644 index 00000000..7bb6804e --- /dev/null +++ b/.vscode/code-style.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 142e7175..8dd72cc1 100644 --- a/pom.xml +++ b/pom.xml @@ -49,26 +49,49 @@ + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + + attach-sources + + jar-no-fork + + + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + .vscode/code-style.xml + LF + + + + + format + + + + + + + + release - - org.apache.maven.plugins - maven-source-plugin - 3.0.0 - - - - - attach-sources - - jar-no-fork - - - - org.apache.maven.plugins maven-javadoc-plugin From 9b34fd2ff26ce106be74fcace659231693167044 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Thu, 8 Jun 2023 08:26:56 -0400 Subject: [PATCH 2/6] docs: add formatting instructions in readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 4d0a54e0..d569f2d8 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,20 @@ public class PushOneDocument { ``` +## Local Setup to Contribute + +### Formatting +Make sure to format your code before each pull request by manually invoking the [formatter-maven-plugin](https://code.revelc.net/formatter-maven-plugin/) Java plugin: +```bash +mvn formatter:format +``` + +You could also configure your IDE to use `.vscode/code-style.xml` for the formatting rules. +In VSCode, you can either update `~/Library/Application Support/Code/User/settings.json` or `.vscode/settings.json` by adding the following instruction: +```json +"java.format.settings.url": ".vscode/code-style.xml" +``` + ## Release * Tag the commit following semver. From 03c978c810cde98074b8338a758c0bdf78abd0d3 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Thu, 8 Jun 2023 09:14:14 -0400 Subject: [PATCH 3/6] ci: change indentation --- .vscode/code-style.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/code-style.xml b/.vscode/code-style.xml index 7bb6804e..bb335f00 100644 --- a/.vscode/code-style.xml +++ b/.vscode/code-style.xml @@ -167,7 +167,7 @@ - + From 99f045c0d7770a71b3def6d0f244b5a87e448eb8 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Fri, 9 Jun 2023 11:42:36 -0400 Subject: [PATCH 4/6] switch to spotless --- .github/workflows/build.yml | 2 +- .gitignore | 2 -- README.md | 11 +++-------- pom.xml | 24 +++++++++++++----------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 493522ea..96b6c600 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: distribution: 'adopt' - name: Validate code format - run: mvn formatter:validate + run: mvn spotless:check - name: Build with Maven run: mvn -B package --file pom.xml diff --git a/.gitignore b/.gitignore index 43e8b80c..61ca0e58 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,3 @@ .env /.idea/ .vscode/* - -!.vscode/code-style.xml \ No newline at end of file diff --git a/README.md b/README.md index d569f2d8..67c9cd4d 100644 --- a/README.md +++ b/README.md @@ -48,15 +48,10 @@ public class PushOneDocument { ## Local Setup to Contribute ### Formatting -Make sure to format your code before each pull request by manually invoking the [formatter-maven-plugin](https://code.revelc.net/formatter-maven-plugin/) Java plugin: -```bash -mvn formatter:format -``` -You could also configure your IDE to use `.vscode/code-style.xml` for the formatting rules. -In VSCode, you can either update `~/Library/Application Support/Code/User/settings.json` or `.vscode/settings.json` by adding the following instruction: -```json -"java.format.settings.url": ".vscode/code-style.xml" +This project uses [Google Java Format](https://github.com/google/google-java-format), so make sure your code is properly formatted before opening a pull request. +```bash +mvn spotless:apply ``` ## Release diff --git a/pom.xml b/pom.xml index 8dd72cc1..9c4183c9 100644 --- a/pom.xml +++ b/pom.xml @@ -69,19 +69,20 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} - .vscode/code-style.xml - LF + + + src/main/java/**/*.java + src/test/java/**/*.java + + + + + - - - - format - - - @@ -192,5 +193,6 @@ 11 11 UTF-8 + 2.37.0 \ No newline at end of file From a86a248fc360117986c59276c1a60959de363c93 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Fri, 9 Jun 2023 11:47:26 -0400 Subject: [PATCH 5/6] chore: remove old files --- .gitignore | 2 +- .vscode/code-style.xml | 337 ----------------------------------------- 2 files changed, 1 insertion(+), 338 deletions(-) delete mode 100644 .vscode/code-style.xml diff --git a/.gitignore b/.gitignore index 61ca0e58..8744fae7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target/ .env /.idea/ -.vscode/* +.vscode diff --git a/.vscode/code-style.xml b/.vscode/code-style.xml deleted file mode 100644 index bb335f00..00000000 --- a/.vscode/code-style.xml +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From e9bbaaeccf27a76df6d933da463f9d9b22aa4bc0 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Fri, 9 Jun 2023 11:48:04 -0400 Subject: [PATCH 6/6] chore: revert commit diff --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8744fae7..d5a7ca72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target/ .env /.idea/ -.vscode +.vscode \ No newline at end of file