diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 48345241..41d75b2a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -1,4 +1,8 @@ name: CI Build + +env: + CIBUILD: true + on: workflow_dispatch: pull_request: diff --git a/README.md b/README.md index 93da61c5..dd28dbd1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # ids.server: Server part of ICAT Data Server (IDS) +## Linting +The [spotless-maven-plugin](https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin) is used here for linting. It uses the Eclipse code formatting feature. The guidelines are defined in `eclipse-formatter.xml` which was initially exported from eclipse (so you can do it again: define rules in eclipse an export the file to use it here). + +An automatically code formatting is triggered while local build. In CI builds the code is only validated. +You also can execute the commands manually: +* `mvn spotless:check` for validation +* `mvn spotless:apply` to update the source code like it is defined in the formatters configuration. + +### Import order +The import order is also validated and applied by the spotless-maven-plugin. It is defined in the file `eclipse-importorder.txt` and referenced in `pom.xml`. It is needed that it has a compatible format like the eclipse built-in import order configuration (better its exported file). + +## Further Information [![Build Status](https://github.com/icatproject/ids.server/workflows/CI%20Build/badge.svg?branch=master)](https://github.com/icatproject/ids.server/actions?query=workflow%3A%22CI+Build%22) General installation instructions are at http://www.icatproject.org/installation/component diff --git a/eclipse-formatter.xml b/eclipse-formatter.xml new file mode 100644 index 00000000..eb9ce20b --- /dev/null +++ b/eclipse-formatter.xml @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse-importorder.txt b/eclipse-importorder.txt new file mode 100644 index 00000000..a7cc5e1e --- /dev/null +++ b/eclipse-importorder.txt @@ -0,0 +1,7 @@ +#Organize Import Order +#Wed Jun 12 08:50:43 CEST 2024 +0=java +1=jakarta +2=org +3=org.icatproject +4=org.icatproject.ids \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9607b7ad..99568a5a 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ UTF-8 https://repo.icatproject.org/repo github + apply @@ -28,6 +29,11 @@ MireDot Releases https://secure-nexus.miredot.com/content/repositories/miredot + + com.diffplug.spotless + spotless-maven-plugin Repo + https://mvnrepository.com/artifact/com.diffplug.spotless/ + @@ -129,6 +135,13 @@ test + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + @@ -415,10 +428,53 @@ + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + src/main/java/**/*.java + src/test/java/**/*.java + + + ${project.basedir}/eclipse-formatter.xml + + + ${project.basedir}/eclipse-importorder.txt + + + + + + + ${spotless.goal} + + compile + + + + + + + cibuild + + + env.CIBUILD + + + + + check + + + +