Просмотр исходного кода

Added spotless configuration. Not applied formatting yet.

Dominik Fuchß 4 лет назад
Родитель
Сommit
e38e320981
4 измененных файлов с 59 добавлено и 0 удалено
  1. 28 0
      .github/workflows/spotless.yml
  2. 1 0
      .mvn/jvm.config
  3. 26 0
      pom.xml
  4. 4 0
      spotless.importorder

+ 28 - 0
.github/workflows/spotless.yml

@@ -0,0 +1,28 @@
+name: Spotless Style Check
+
+on:
+  push: 
+  pull_request:
+    types: [opened, synchronize, reopened]
+  
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2.4.0
+
+    - name: Set up JDK
+      uses: actions/setup-java@v2
+      with:
+        java-version: 14
+        distribution: 'zulu'
+      
+    - name: Check with Spotless
+      run: mvn clean spotless:check
+      
+      
+

+ 1 - 0
.mvn/jvm.config

@@ -0,0 +1 @@
+--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

+ 26 - 0
pom.xml

@@ -70,6 +70,7 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <maven.compiler.source>14</maven.compiler.source>
     <maven.compiler.target>14</maven.compiler.target>
+    <spotless.version>2.20.0</spotless.version>
   </properties>
 
   <build>
@@ -145,6 +146,31 @@
           <autoReleaseAfterClose>true</autoReleaseAfterClose>
         </configuration>
       </plugin>
+      <plugin>
+          <groupId>com.diffplug.spotless</groupId>
+          <artifactId>spotless-maven-plugin</artifactId>
+          <version>${spotless.version}</version>
+          <configuration>
+            <java>
+              <eclipse>
+                <file>${maven.multiModuleProjectDirectory}/formatter.xml</file>
+              </eclipse>
+
+              <importOrder>
+                <file>spotless.importorder</file>
+              </importOrder>
+              <removeUnusedImports></removeUnusedImports>
+            </java>
+            <pom>
+              <sortPom>
+                <encoding>UTF-8</encoding>
+                <keepBlankLines>true</keepBlankLines>
+                <indentBlankLines>false</indentBlankLines>
+                <nrOfIndentSpace>2</nrOfIndentSpace>
+              </sortPom>
+            </pom>
+          </configuration>
+        </plugin>
     </plugins>
     <pluginManagement>
       <plugins>

+ 4 - 0
spotless.importorder

@@ -0,0 +1,4 @@
+0=java
+1=javax
+2=org
+3=de