diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..045d61d56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.java text diff=java eol=lf +*.gradle text diff=java eol=lf diff --git a/.gitignore b/.gitignore index e784eb173..7ef22217a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ src/generated # include git important files !.gitmodules !.gitignore +!.gitattributes # code format to reduce noise in git commits !codeformat/ diff --git a/build.gradle b/build.gradle index b341f3b6b..d338e1b17 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,7 @@ buildscript { } plugins { + id "com.diffplug.gradle.spotless" version "4.3.0" id "org.sonarqube" version "2.8" id "jacoco" } @@ -92,6 +93,7 @@ configurations { } apply from: 'gradle/scripts/dependencies.gradle' +apply from: 'gradle/scripts/spotless.gradle' minecraft { mappings channel: "snapshot", version: project.mcp_mappings diff --git a/codeformat/ae2-intellij-settings.jar b/codeformat/ae2-intellij-settings.jar deleted file mode 100644 index 7cde89685..000000000 Binary files a/codeformat/ae2-intellij-settings.jar and /dev/null differ diff --git a/codeformat/eclipse.importorder b/codeformat/ae2.importorder similarity index 100% rename from codeformat/eclipse.importorder rename to codeformat/ae2.importorder diff --git a/codeformat/checkstyle.xml b/codeformat/checkstyle.xml deleted file mode 100644 index 2a6bebe20..000000000 --- a/codeformat/checkstyle.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/codeformat/eclipse-code-format.xml b/codeformat/codeformat.xml similarity index 73% rename from codeformat/eclipse-code-format.xml rename to codeformat/codeformat.xml index 443a25681..be037c27c 100644 --- a/codeformat/eclipse-code-format.xml +++ b/codeformat/codeformat.xml @@ -1,20 +1,20 @@ - - + + - + - - + + @@ -25,182 +25,214 @@ + - + - + + + - - + + - + - - - + + + + + - - + - - + + - + - - + + + + + - - + - + + + + - - + + - - - + + + + + + + - + - + + + + + + - - - + + + + - + + - + - - - - - + + + + + + + - - + + - + - - + + + - + - - + + + + + - + - + + - - - + + + + + + - - - - - + + + + + - + - + + - + + - + - + - - + + - + - + - - - + + + - - + + @@ -210,7 +242,8 @@ - + + @@ -220,95 +253,113 @@ - + - + - + + - + + - + - - - + + + + - + - + + - + + + + - + + - - + + + + + - - - - - + + + + + + - - + + + + - + + - + - - + + + + + - - - + + + diff --git a/codeformat/copyright.txt b/codeformat/copyright.txt index 5654ca525..dda9d160c 100644 --- a/codeformat/copyright.txt +++ b/codeformat/copyright.txt @@ -1,5 +1,5 @@ This file is part of Applied Energistics 2. -Copyright (c) 2013 - $today.year, AlgorithmX2, All rights reserved. +Copyright (c) 2013 - $YEAR, AlgorithmX2, All rights reserved. Applied Energistics 2 is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle new file mode 100644 index 000000000..967688862 --- /dev/null +++ b/gradle/scripts/spotless.gradle @@ -0,0 +1,31 @@ +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2013 - 2020, AlgorithmX2, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *g GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + +spotless { + java { + target 'src/*/java/appeng/**/*.java' + + indentWithSpaces() + eclipse().configFile 'codeformat/codeformat.xml' + importOrderFile 'codeformat/ae2.importorder' + } + format 'json', { + target 'src/*/resources/**/*.json' + prettier().config(['parser': 'json']) + } +} \ No newline at end of file