Skip to content

Commit

Permalink
Merge pull request #2 from EpimorphicPioneers/spotless
Browse files Browse the repository at this point in the history
使用spotless来格式化项目
  • Loading branch information
qwer523 authored Jun 8, 2024
2 parents da25d90 + 8f2ea4b commit e7b1bf3
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 408 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/style_check.yml

This file was deleted.

6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias libs.plugins.architectury.loom
alias libs.plugins.machete // automatic jar compressing on build
alias libs.plugins.shadow
alias libs.plugins.spotless
}

apply plugin: "dev.architectury.loom"
Expand Down Expand Up @@ -36,6 +37,7 @@ apply from: "$rootDir/gradle/scripts/dependencies.gradle"
apply from: "$rootDir/gradle/scripts/resources.gradle"
apply from: "$rootDir/gradle/scripts/jars.gradle"
apply from: "$rootDir/gradle/scripts/publishing.gradle"
apply from: "$rootDir/gradle/scripts/spotless.gradle"

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
Expand All @@ -44,4 +46,6 @@ tasks.withType(JavaCompile) {
machete {
// disable machete locally for faster builds
enabled = false
}
}

tasks.build.dependsOn(tasks.spotlessCheck)
2 changes: 1 addition & 1 deletion gradle/scripts/architectury_loom.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ loom {
}
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/scripts/capabilities.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ configurations {
// capability("io.github.llamalad7:mixinextras-forge:${this.forge.versions.mixinextras.get()}")
// }
// }
}
}
2 changes: 1 addition & 1 deletion gradle/scripts/jars.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ remapSlimJar {

tasks.remapJar.dependsOn('remapSlimJar')

archivesBaseName = "${project.name}-${libs.versions.minecraft.get()}"
archivesBaseName = "${project.name}-${libs.versions.minecraft.get()}"
2 changes: 1 addition & 1 deletion gradle/scripts/repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ repositories {
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
maven { url 'https://jitpack.io' } // Mixin Extras, Fabric ASM
maven { url = "https://server.cjsah.net:1002/maven/" }
}
}
2 changes: 1 addition & 1 deletion gradle/scripts/resources.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ processResources {
filesMatching("META-INF/mods.toml") {
expand properties
}
}
}
23 changes: 23 additions & 0 deletions gradle/scripts/spotless.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
spotless {
encoding 'UTF-8'
format 'misc', {
target '.gitignore', '*.gradle', 'gradle/scripts/*.gradle'

trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
java {
target 'src/*/java/**/*.java'

importOrder()
removeUnusedImports()

palantirJavaFormat().style("GOOGLE")
indentWithTabs(2)
indentWithSpaces(4)

cleanthat()
formatAnnotations()
}
}
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencyResolutionManagement {
def mixinextrasVersion = "0.3.2"
def shimmerVersion = "0.2.2"
def monomorphismLibVersion = "1.0.10-build.17"
def spotlessVersion = "7.0.0.BETA1"

forge {
version("forgeShortVersion", forgeVersion)
Expand Down Expand Up @@ -114,6 +115,9 @@ dependencyResolutionManagement {

def machete = version("machete", macheteVersion)
plugin("machete", "io.github.p03w.machete").versionRef(machete)

def spotless = version("spotless", spotlessVersion)
plugin("spotless", "com.diffplug.spotless").versionRef(spotless)
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/example/examplemod/ExampleGTAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@ public ExampleGTAddon() {
}

@Override
public void initializeAddon() {

}

public void initializeAddon() {}
}
1 change: 0 additions & 1 deletion src/main/java/com/example/examplemod/ExampleMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ public static MORegistrate registrate() {
public static INetworking network() {
return instance.getNetwork();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ public class ClientProxy extends CommonProxy implements IClientProxyBase {
public ClientProxy() {
super();
}

}
8 changes: 2 additions & 6 deletions src/main/java/com/example/examplemod/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ public CommonProxy() {
}

@Override
public void registerEventHandlers() {

}
public void registerEventHandlers() {}

@Override
public void registerCapabilities() {

}
public void registerCapabilities() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import dev.toma.configuration.Configuration;
import dev.toma.configuration.config.Config;
import dev.toma.configuration.config.format.ConfigFormats;

@Config(id = ExampleMod.MODID)
public class ExampleConfigHolder {
public static ExampleConfigHolder INSTANCE;

public static void init() {
if (INSTANCE == null) {
INSTANCE = Configuration.registerConfig(ExampleConfigHolder.class, ConfigFormats.yaml()).getConfigInstance();
INSTANCE = Configuration.registerConfig(ExampleConfigHolder.class, ConfigFormats.yaml())
.getConfigInstance();
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

public class ExampleLangHandler {

private ExampleLangHandler() {/**/}

public static void init(MOLangProvider provider) {

private ExampleLangHandler() {
/**/
}

public static void init(MOLangProvider provider) {}
}
Loading

0 comments on commit e7b1bf3

Please sign in to comment.