Add Kyori/Adventure checkstyle

This commit is contained in:
Draycia committed 2020-09-09 20:04:01 -07:00
1 parent d7afcc38e1
commit 5d3394bb36
4 files changed
+326 -79

No files matched your search

+179
View File
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- MIT License-->
<!-- Copyright (c) 2017-2020 KyoriPowered-->
<!-- Permission is hereby granted, free of charge, to any person obtaining a copy-->
<!-- of this software and associated documentation files (the "Software"), to deal-->
<!-- in the Software without restriction, including without limitation the rights-->
<!-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-->
<!-- copies of the Software, and to permit persons to whom the Software is-->
<!-- furnished to do so, subject to the following conditions:-->
<!-- The above copyright notice and this permission notice shall be included in all-->
<!-- copies or substantial portions of the Software.-->
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-->
<!-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-->
<!-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-->
<!-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-->
<!-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-->
<!-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE-->
<!-- SOFTWARE.-->
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<module name="SuppressionFilter">
<property name="file" value="${basedir}/suppressions.xml"
default=".checkstyle/suppressions.xm" />
<property name="optional" value="true"/>
</module>
<!-- allow // CHECKSTYLE:OFF and // CHECKSTYLE:ON comments -->
<module name="SuppressWithPlainTextCommentFilter"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.org/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="NewlineAtEndOfFile"/>
<module name="TreeWalker">
<!-- no space between parameters and parenthesis -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="StatementNoWhitespaceAfter">
<property name="tokens" value="LITERAL_IF, LITERAL_FOR, LITERAL_WHILE, LITERAL_CATCH, LITERAL_TRY"/>
</module>
<!-- one empty line between each class element -->
<module name="EmptyLineSeparator">
<!-- No new line after the license header -->
<property name="tokens"
value="IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
</module>
<module name="GenericWhitespace"/>
<!-- packages and imports must be on one line each -->
<module name="NoLineWrap"/>
<module name="NoWhitespaceAfter">
<property name="allowLineBreaks" value="false"/>
</module>
<module name="SingleSpaceSeparator">
<property name="validateComments" value="true"/>
</module>
<module name="TypecastParenPad"/>
<module name="UnnecessaryParentheses"/>
<!-- field and method access qualified with `this` -->
<module name="FinalLocalVariable">
<property name="validateEnhancedForLoopVariable" value="true"/>
<property name="tokens" value="VARIABLE_DEF, PARAMETER_DEF"/>
</module>
<module name="RequireThis">
<property name="validateOnlyOverlapping" value="false"/>
</module>
<!-- coding practices -->
<module name="RedundantImport"/>
<module name="RedundantModifier">
<!-- Take out METHOD_DEF and RESOURCE so we can have finals -->
<property name="tokens"
value="VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CTOR_DEF, CLASS_DEF, ENUM_DEF"/>
</module>
<module name="UnusedImports"/>
<module name="HideUtilityClassConstructor"/>
<module name="FinalClass"/>
<!-- no local variable type annotations -->
<module name="NoLvTypeAnnotations"/>
<!-- braces and parentheses on block statements on same line -->
<module name="LeftCurly"/>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/>
</module>
<!-- 2 space indentation -->
<module name="Indentation">
<property name="basicOffset" value="2"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="2"/>
<property name="throwsIndent" value="2"/>
<property name="lineWrappingIndentation" value="0"/>
<property name="arrayInitIndent" value="2"/>
</module>
<module name="CommentsIndentation"/>
<!-- some generally unwanted imports -->
<module name="IllegalImport">
<property name="illegalPkgs" value="sun, jdk, com.sun"/>
</module>
<!-- no get* or set* method names -->
<module name="MethodName">
<property name="format" value="^(?:(?:.{1,3})|(?:[gs]et[^A-Z].*)|(?:(?:[^gsA-Z]..|.[^e].|..[^t]).+))$"/>
</module>
<!-- misc formatting based on Google style -->
<!-- match filenames, don't use unicode escapes, no star imports -->
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="FallThrough"/>
<module name="NoFinalizer"/>
<module name="MethodParamPad">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
LABELED_STAT, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
</module>
</module>
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- MIT License-->
<!-- Copyright (c) 2017-2020 KyoriPowered-->
<!-- Permission is hereby granted, free of charge, to any person obtaining a copy-->
<!-- of this software and associated documentation files (the "Software"), to deal-->
<!-- in the Software without restriction, including without limitation the rights-->
<!-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-->
<!-- copies of the Software, and to permit persons to whom the Software is-->
<!-- furnished to do so, subject to the following conditions:-->
<!-- The above copyright notice and this permission notice shall be included in all-->
<!-- copies or substantial portions of the Software.-->
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-->
<!-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-->
<!-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-->
<!-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-->
<!-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-->
<!-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE-->
<!-- SOFTWARE.-->
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"http://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<!-- add any necessary suppressions here -->
<suppress files="src[\\/]test[\\/]java[\\/].*" checks="RequireExplicitVisibilityModifier"/>
<suppress files=".*[\\/]nbt[\\/](List|Compound)BinaryTag.java" checks="MethodName"/>
</suppressions>
+30
View File
@@ -0,0 +1,30 @@
# MIT License
#
# Copyright (c) 2017-2020 KyoriPowered
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = off
+85 -79
View File
@@ -1,12 +1,14 @@
plugins {
id 'java'
id 'java-library'
id 'maven'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
id 'com.palantir.git-version' version '0.12.3'
id 'org.checkerframework' version '0.5.9'
id 'checkstyle'
id 'java'
id 'java-library'
id 'maven'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
id 'com.palantir.git-version' version '0.12.3'
id 'org.checkerframework' version '0.5.9'
id 'com.github.sherter.google-java-format' version '0.8'
}
// Gets the git commit hash of the latest commit, used for version string
@@ -17,90 +19,94 @@ group = 'net.draycia'
description = 'CarbonChat'
version = project.property('projectVersion') + '-' + gitHash
repositories {
mavenLocal()
mavenCentral()
checkstyle {
def configRoot = new File(rootProject.projectDir, '.checkstyle')
toolVersion = '8.34'
configDirectory = configRoot
configProperties = [basedir: configRoot.getAbsolutePath()]
}
maven {url = 'https://maven.enginehub.org/repo/'}
maven {url = 'https://repo.maven.apache.org/maven2'}
maven {url = 'https://papermc.io/repo/repository/maven-public/'}
maven {url = 'https://oss.sonatype.org/content/groups/public/'}
maven {url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'}
maven {url = 'https://jitpack.io'}
maven {url = 'https://dl.bintray.com/ichbinjoe/public/'}
maven {url = 'https://repo.codemc.org/repository/maven-public/'}
maven {url = 'https://repo.minebench.de/'}
maven {url = "https://repo.aikar.co/content/groups/aikar/"}
maven {url = 'https://raw.githubusercontent.com/JorelAli/CommandAPI/mvn-repo/'}
repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://maven.enginehub.org/repo/' }
maven { url = 'https://repo.maven.apache.org/maven2' }
maven { url = 'https://papermc.io/repo/repository/maven-public/' }
maven { url = 'https://oss.sonatype.org/content/groups/public/' }
maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
maven { url = 'https://jitpack.io' }
maven { url = 'https://dl.bintray.com/ichbinjoe/public/' }
maven { url = 'https://repo.codemc.org/repository/maven-public/' }
maven { url = 'https://repo.minebench.de/' }
maven { url = "https://repo.aikar.co/content/groups/aikar/" }
maven { url = 'https://raw.githubusercontent.com/JorelAli/CommandAPI/mvn-repo/' }
}
dependencies {
// Components
compile 'net.kyori:adventure-api:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT'
compile 'de.themoep:minedown-adventure:1.6.1-SNAPSHOT'
// Components
compile 'net.kyori:adventure-api:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT'
compile 'net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT'
compile 'de.themoep:minedown-adventure:1.6.1-SNAPSHOT'
// Databases
compile 'co.aikar:idb-bukkit:1.0.0-SNAPSHOT'
compile 'com.zaxxer:HikariCP:2.4.1'
// Databases
compile 'co.aikar:idb-bukkit:1.0.0-SNAPSHOT'
compile 'com.zaxxer:HikariCP:2.4.1'
// Messaging
compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT'
compile 'io.lettuce:lettuce-core:6.0.0.M1'
// Messaging
compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT'
compile 'io.lettuce:lettuce-core:6.0.0.M1'
// Commands
compile "dev.jorel:commandapi-shade:4.1"
// Commands
compile "dev.jorel:commandapi-shade:4.1"
// Plugins
compileOnly('com.gmail.nossr50.mcMMO:mcMMO:2.1.143') {
exclude group: 'org.jetbrains', module: 'annotations'
}
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT') {
exclude group: 'org.spigotmc', module: 'spigot-api' // Honestly?
}
compileOnly 'me.clip:placeholderapi:2.10.9'
compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11'
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
compileOnly 'com.vexsoftware:nuvotifier-universal:2.6.0'
compileOnly 'net.luckperms:api:5.1'
// Plugins
compileOnly('com.gmail.nossr50.mcMMO:mcMMO:2.1.143') {
exclude group: 'org.jetbrains', module: 'annotations'
}
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT') {
exclude group: 'org.spigotmc', module: 'spigot-api' // Honestly?
}
compileOnly 'me.clip:placeholderapi:2.10.9'
compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11'
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
compileOnly 'com.vexsoftware:nuvotifier-universal:2.6.0'
compileOnly 'net.luckperms:api:5.1'
// Server
compileOnly 'com.destroystokyo.paper:paper-api:1.16.2-R0.1-SNAPSHOT'
// Server
compileOnly 'com.destroystokyo.paper:paper-api:1.16.2-R0.1-SNAPSHOT'
}
// Generates plugin.yml automatically
bukkit {
name = project.description
version = project.version
main = 'net.draycia.carbon.CarbonChat'
apiVersion = '1.13'
author = 'Draycia'
depend = ['PlaceholderAPI', 'Vault']
softDepend = ['LuckPerms', 'Towny', 'mcMMO', 'WorldGuard']
loadBefore = ["Essentials"]
permissions {
'carbonchat.channels.global.see' {
setDefault("TRUE")
}
'carbonchat.channels.global.use' {
setDefault("TRUE")
}
name = project.description
version = project.version
main = 'net.draycia.carbon.CarbonChat'
apiVersion = '1.13'
author = 'Draycia'
depend = ['PlaceholderAPI', 'Vault']
softDepend = ['LuckPerms', 'Towny', 'mcMMO', 'WorldGuard']
loadBefore = ["Essentials"]
permissions {
'carbonchat.channels.global.see' {
setDefault("TRUE")
}
'carbonchat.channels.global.use' {
setDefault("TRUE")
}
}
}
sourceCompatibility = '1.8'
// Set output directory and encoding
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Jar) {
getDestinationDirectory().set(file("$rootDir/build"))
options.encoding = 'UTF-8'
options.compilerArgs += ['-Xlint:all']
}
// Automatically shadowJar when building
@@ -108,25 +114,25 @@ tasks.build.dependsOn tasks.shadowJar
// Output a single jar
shadowJar {
minimize()
archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar")
minimize()
archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar")
}
jar {
archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar")
archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar")
}
// Automatically relocate all shaded dependencies
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "net.draycia.carbon.libs" // Default value is "shadow"
target = tasks.shadowJar
prefix = "net.draycia.carbon.libs" // Default value is "shadow"
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar
// Cleanup custom output directory on clean task
clean.doFirst {
delete "$rootDir/build/bundled"
}
delete "$rootDir/build/bundled"
}