diff --git a/.editorconfig b/.editorconfig index 05586dfd..6ef7c0dc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,7 @@ tab_width = 4 [*.{gradle,java}] ij_continuation_indent_size = 8 -ij_java_imports_layout = $*,|,java.**,|,javax.**,|,*,|,net.fabricmc.** +ij_java_imports_layout = $*,|,java.**,|,javax.**,|,*,|,net.fabricmc.**,|,matcher.** ij_java_class_count_to_use_import_on_demand = 999 [*.{yml,yaml}] diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..cc23192c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto eol=lf +*.bat text eol=crlf diff --git a/build.gradle b/build.gradle index e0f4f7ce..c642745e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'application' id 'maven-publish' id "checkstyle" + id 'com.diffplug.spotless' id 'org.openjfx.javafxplugin' id 'org.gradlex.extra-java-module-info' id 'com.gradleup.shadow' @@ -30,6 +31,17 @@ checkstyle { toolVersion = project.checkstyle_version } +spotless { + lineEndings = com.diffplug.spotless.LineEnding.UNIX + + java { + removeUnusedImports() + importOrder('java.', 'javax.', '', 'net.fabricmc.', 'matcher.') + indentWithTabs() + trimTrailingWhitespace() + } +} + java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/checkstyle.xml b/checkstyle.xml index 705b7661..483f4860 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -5,9 +5,10 @@ + - - + + @@ -47,6 +48,7 @@ if is a space, indicating a formatting error or ' */', it'll ignore the instance if is a tab, indicating a continued line, it'll ignore the instance is 'if', 'do', 'while', 'for', 'try' or nothing (instance initializer block) + - first \n: with positive lookbehind (?<=\n) to move the error marker to a more reasonable place - capture tabs for , later referenced via \1 - remaining preceding line as a non-comment (doesn't start with '/', '//', ' ' or '\t') or multiple lines where all but the first are a single line comment with the same indentation @@ -66,6 +68,13 @@ + + + + + + + @@ -74,7 +83,7 @@ - + @@ -112,11 +121,11 @@ - + - - - + + + @@ -128,8 +137,7 @@ - + @@ -159,6 +167,8 @@ + + diff --git a/gradle.properties b/gradle.properties index 59440c97..081e8790 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,7 @@ org.gradle.jvmargs=-Xmx2G # Gradle Plugins +spotless_version = 6.25.0 javafx_plugin_version = 0.1.0 extra_java_module_info_version = 1.9 shadow_version = 8.3.5 diff --git a/settings.gradle b/settings.gradle index 09532e5d..3567a5af 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,6 +4,7 @@ pluginManagement { mavenCentral(); } plugins { + id 'com.diffplug.spotless' version "${spotless_version}" id 'org.openjfx.javafxplugin' version "${javafx_plugin_version}" id 'org.gradlex.extra-java-module-info' version "${extra_java_module_info_version}" id 'com.gradleup.shadow' version "${shadow_version}" diff --git a/src/main/java/matcher/gui/menu/UidMenu.java b/src/main/java/matcher/gui/menu/UidMenu.java index 84df5d9d..7c5cd0f9 100644 --- a/src/main/java/matcher/gui/menu/UidMenu.java +++ b/src/main/java/matcher/gui/menu/UidMenu.java @@ -26,8 +26,8 @@ import matcher.type.ClassEnvironment; import matcher.type.ClassInstance; import matcher.type.FieldInstance; -import matcher.type.Matchable; import matcher.type.MatchType; +import matcher.type.Matchable; import matcher.type.MemberInstance; import matcher.type.MethodInstance; import matcher.type.MethodVarInstance; diff --git a/src/main/java/matcher/srcprocess/SrcDecorator.java b/src/main/java/matcher/srcprocess/SrcDecorator.java index f694af43..a8fc5da4 100644 --- a/src/main/java/matcher/srcprocess/SrcDecorator.java +++ b/src/main/java/matcher/srcprocess/SrcDecorator.java @@ -8,6 +8,7 @@ import com.github.javaparser.JavaParser; import com.github.javaparser.JavaToken; +import com.github.javaparser.JavaToken.Kind; import com.github.javaparser.ParseResult; import com.github.javaparser.ParserConfiguration; import com.github.javaparser.ParserConfiguration.LanguageLevel; @@ -15,7 +16,6 @@ import com.github.javaparser.Problem; import com.github.javaparser.Range; import com.github.javaparser.TokenRange; -import com.github.javaparser.JavaToken.Kind; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.Node; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; diff --git a/src/main/java/matcher/srcprocess/TypeResolver.java b/src/main/java/matcher/srcprocess/TypeResolver.java index 1faeb31a..27302ebb 100644 --- a/src/main/java/matcher/srcprocess/TypeResolver.java +++ b/src/main/java/matcher/srcprocess/TypeResolver.java @@ -24,10 +24,10 @@ import com.github.javaparser.ast.type.Type; import com.github.javaparser.ast.type.VoidType; -import matcher.type.ClassInstance; -import matcher.type.FieldInstance; import matcher.NameType; import matcher.type.ClassEnv; +import matcher.type.ClassInstance; +import matcher.type.FieldInstance; import matcher.type.Matchable; import matcher.type.MethodInstance;