Skip to content

Commit

Permalink
Apply checkstyle to the project to ensure formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
2008Choco committed Jan 8, 2021
1 parent 2d1be37 commit a24b6db
Show file tree
Hide file tree
Showing 52 changed files with 323 additions and 201 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local.properties
.settings/
.loadpath
.recommenders
.checkstyle

# External tool builders
.externalToolBuilders/
Expand Down
116 changes: 116 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!-- Modified (and more strict) version of Bukkit's checkstyle.xml See: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/checkstyle.xml -->

<module name="Checker">
<!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf_cr_crlf" />
</module>

<!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
<module name="FileTabCharacter" />

<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$" />
<property name="minimum" value="0" />
<property name="maximum" value="0" />
<property name="message" value="Line has trailing spaces." />
</module>

<module name="TreeWalker">
<!-- See http://checkstyle.sourceforge.net/config_annotation.html -->
<module name="MissingOverride" />

<!-- See http://checkstyle.sourceforge.net/config_blocks.html -->
<module name="AvoidNestedBlocks" />
<module name="LeftCurly" />
<module name="NeedBraces">
<property name="allowEmptyLoopBody" value="true" />
</module>

<!-- See https://checkstyle.org/config_javadoc.html -->
<module name="AtclauseOrder" />
<module name="InvalidJavadocPosition" />
<module name="JavadocBlockTagLocation" />
<module name="JavadocContentLocationCheck" />
<module name="JavadocMethod" />
<module name="JavadocStyle">
<property name="scope" value="public" />
<property name="excludeScope" value="private" />
</module>
<module name="JavadocType" />
<module name="MissingJavadocPackage" />
<module name="NonEmptyAtclauseDescription" />

<!-- See http://checkstyle.sourceforge.net/config_filters.html -->
<module name="SuppressionCommentFilter" />

<!-- See http://checkstyle.sourceforge.net/config_imports.html -->
<module name="AvoidStarImport">
<property name="allowStaticMemberImports" value="true" />
</module>
<module name="ImportOrder">
<property name="option" value="bottom" />
<property name="groups"
value="/^co\./, com, /^java\./, javax, me, net, org, tk, wtf" />
<property name="ordered" value="true" />
<property name="separated" value="true" />
<property name="separatedStaticGroups" value="true" />
<property name="sortStaticImportsAlphabetically"
value="true" />
</module>
<module name="RedundantImport" />
<module name="UnusedImports" />

<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<module name="ArrayTypeStyle" />
<module name="UpperEll" />

<!-- See https://checkstyle.org/config_whitespace.html -->
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoLineWrap" />
<module name="NoWhitespaceAfter" />
<module name="NoWhitespaceBefore">
<property name="allowLineBreaks" value="true" />
</module>
<module name="OperatorWrap" />
<module name="ParenPad" />
<module name="SingleSpaceSeparator" />
<module name="TypecastParenPad" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround">
<property name="allowEmptyCatches" value="true" />
<property name="allowEmptyConstructors" value="true" />
<property name="allowEmptyMethods" value="true" />
<property name="allowEmptyTypes" value="true" />
</module>

<!-- See http://checkstyle.sourceforge.net/config_modifiers.html -->
<module name="ModifierOrder" />

<!-- See http://checkstyle.sourceforge.net/config_naming.html -->
<module name="ClassTypeParameterName" />
<module name="ConstantName" />
<module name="InterfaceTypeParameterName" />
<module name="LambdaParameterName" />
<module name="LocalFinalVariableName" />
<module name="LocalVariableName" />
<module name="MemberName" />
<module name="MethodName" />
<module name="MethodTypeParameterName" />
<module name="PackageName" />
<module name="ParameterName" />
<module name="StaticVariableName" />
<module name="TypeName" />

<!-- See http://checkstyle.sourceforge.net/config_design.html -->
<module name="FinalClass" />
<module name="InterfaceIsType" />
</module>
</module>
209 changes: 117 additions & 92 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,100 +1,125 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.choco</groupId>
<artifactId>AlchemicalArrows</artifactId>
<version>3.2.1</version>
<name>AlchemicalArrows</name>
<description>Arrows with alchemical properties, each performing thematic in-world effects</description>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.choco</groupId>
<artifactId>AlchemicalArrows</artifactId>
<version>3.2.1</version>
<name>AlchemicalArrows</name>
<description>Arrows with alchemical properties, each performing thematic in-world effects</description>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
</plugins>
</reporting>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>wtf.choco.arrows.utils.metrics</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>worldedit-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>wtf.choco.arrows.utils.metrics</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>17.0.0</version>
<scope>provided</scope>
</dependency>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>worldedit-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>17.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.2008Choco</groupId>
<artifactId>Alchema</artifactId>
<version>1.0.2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.2008Choco</groupId>
<artifactId>Alchema</artifactId>
<version>1.0.2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
3 changes: 1 addition & 2 deletions src/main/java/wtf/choco/arrows/AlchemicalArrows.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -316,4 +315,4 @@ private Block blockFromString(@NotNull String value) {
return (x != Integer.MIN_VALUE && y != Integer.MIN_VALUE && z != Integer.MIN_VALUE) ? world.getBlockAt(x, y, z) : null;
}

}
}
3 changes: 1 addition & 2 deletions src/main/java/wtf/choco/arrows/api/AlchemicalArrow.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.projectiles.BlockProjectileSource;

import org.jetbrains.annotations.NotNull;

import wtf.choco.arrows.AlchemicalArrows;
Expand Down Expand Up @@ -261,4 +260,4 @@ public boolean equals(Object object) {
return object == this || (object instanceof AlchemicalArrow && Objects.equals(getKey(), ((AlchemicalArrow) object).getKey()));
}

}
}
6 changes: 3 additions & 3 deletions src/main/java/wtf/choco/arrows/api/AlchemicalArrowEntity.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package wtf.choco.arrows.api;

import java.util.Objects;

import com.google.common.base.Preconditions;

import java.util.Objects;

import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Arrow;
Expand Down Expand Up @@ -103,4 +103,4 @@ public boolean equals(Object object) {
return Objects.equals(implementation, other.implementation) && Objects.equals(arrow, other.arrow);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public AlchemicalArrowEntity getArrow() {
return arrow;
}

}
}
Loading

0 comments on commit a24b6db

Please sign in to comment.