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/.spotless/eclipse-formatter.xml b/.spotless/eclipse-formatter.xml new file mode 100644 index 00000000..30a63498 --- /dev/null +++ b/.spotless/eclipse-formatter.xml @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.spotless/eclipse-importorder.txt b/.spotless/eclipse-importorder.txt new file mode 100644 index 00000000..14a1749c --- /dev/null +++ b/.spotless/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 diff --git a/README.md b/README.md index 93da61c5..1e32c633 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 `.spotless/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). + +By default, code checks are disabled for local builds, but enforced in the CI build pipeline. +You also can execute the commands manually: +* `mvn spotless:check -Dspotless.check.skip=false` to validate the source files, +* `mvn spotless:apply` to directly change the source files according to the linting. + +### Import order +The import order is also validated and applied by the spotless-maven-plugin. It is defined in the file `.spotless/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/pom.xml b/pom.xml index 4fb68fc6..a0eb4130 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,9 @@ UTF-8 https://repo.icatproject.org/repo github + check + true + NONE @@ -27,6 +30,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/ + @@ -128,6 +136,13 @@ test + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + @@ -414,10 +429,55 @@ + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + ${spotless.ratchetFrom} + + + src/main/java/**/*.java + src/test/java/**/*.java + + + ${project.basedir}/.spotless/eclipse-formatter.xml + + + ${project.basedir}/.spotless/eclipse-importorder.txt + + + + + + + ${spotless.goal} + + compile + + + + + + + cibuild + + + env.CIBUILD + + + + + false + + + +