diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4c17a8eb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# EditorConfig: maintain consistent coding styles for multiple +# developers working on the same project across various editors and +# IDEs, see https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +# Set default charset and 4 space indentation for all xml, xslt, xpl, +# xprocspec and xspec files +[*.{xml,xpl,xsl,xprocspec,xspec}] +charset = utf-8 +indent_style = space +indent_size = 4 + + + diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml new file mode 100644 index 00000000..208360e1 --- /dev/null +++ b/.github/workflows/check-format.yml @@ -0,0 +1,17 @@ +name: Check code conventions + +on: [push] + +jobs: + check-code-conventions: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '11' + - name: Build with Maven + run: mvn --batch-mode editorconfig:check diff --git a/README.md b/README.md index daef2e1f..fec22530 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,12 @@ The nordic migrator can be built with Maven, either directly (with for instance `mvn clean package`), or indirectly with Docker (with for instance `docker build .`). +To check the code conventions use a special Maven plugin: `mvn +editorconfig:check`. The conventions are defined in `.editorconfig` +which is picked up by most editors, see https://editorconfig.org/. You +can also fix the conventions in all files with `mvn +editorconfig:format`. + Releasing --------- diff --git a/pom.xml b/pom.xml index 42391675..c026e6d4 100644 --- a/pom.xml +++ b/pom.xml @@ -172,6 +172,28 @@ + + org.ec4j.maven + editorconfig-maven-plugin + 0.1.1 + + + check + compile + + check + + + + + + + src/test/**/*.epub + **/*.otf + documentation/*.odg + + +