Skip to content

Commit

Permalink
Merge branch 'dev/feature' into reserve-var-chars
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus authored Nov 20, 2024
2 parents 176df76 + a45c0b9 commit a3ea7f0
Show file tree
Hide file tree
Showing 318 changed files with 11,785 additions and 3,616 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: checkstyle

on:
push:
branches:
- master
- 'dev/**'
pull_request:

jobs:
build:
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run checkstyle
run: ./gradlew clean checkstyleMain
- name: Upload checkstyle report
uses: actions/upload-artifact@v4
if: success()
with:
name: checkstyle-report
path: |
build/reports/checkstyle/*.xml
build/reports/checkstyle/*.html
15 changes: 13 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'maven-publish'
id 'java'
id 'checkstyle'
}

configurations {
Expand All @@ -29,8 +30,13 @@ dependencies {
shadow group: 'org.bstats', name: 'bstats-bukkit', version: '3.0.2'
shadow group: 'net.kyori', name: 'adventure-text-serializer-bungeecord', version: '4.3.2'

implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.21-R0.1-SNAPSHOT'
implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.21.3-R0.1-SNAPSHOT'
implementation group: 'com.google.code.findbugs', name: 'findbugs', version: '3.0.1'

// bundled with Minecraft 1.19.4+ for display entity transforms
implementation group: 'org.joml', name: 'joml', version: '1.10.5'

// Plugin hook libraries
implementation group: 'com.sk89q.worldguard', name: 'worldguard-legacy', version: '7.0.0-SNAPSHOT'
implementation group: 'net.milkbowl.vault', name: 'Vault', version: '1.7.3', {
exclude group: 'org.bstats', module: 'bstats-bukkit'
Expand All @@ -42,6 +48,11 @@ dependencies {
testShadow group: 'org.easymock', name: 'easymock', version: '5.4.0'
}

checkstyle {
configFile = new File("checkstyle.xml")
sourceSets = [] // disables checkstyle after build task
}

task checkAliases {
description 'Checks for the existence of the aliases.'
doLast {
Expand Down Expand Up @@ -233,7 +244,7 @@ void createTestTask(String name, String desc, String environments, int javaVersi
def java21 = 21
def java17 = 17

def latestEnv = 'java21/paper-1.21.0.json'
def latestEnv = 'java21/paper-1.21.3.json'
def latestJava = java21
def oldestJava = java17

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

<module name="Checker">

<!--Basic Settings-->
<!--Warning severity so the builds do not fail because of checkstyle, this is mainly for the GitHub workflow-->
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<!--At most 120 characters per line-->
<module name="LineLength">
<property name="max" value="120"/>
</module>

<!--New line at the end of the file-->
<module name="NewlineAtEndOfFile"/>

<module name="TreeWalker">

<!--Tabs, no spaces-->
<module name="RegexpSinglelineJava">
<property name="format" value="^\t* "/>
<property name="message" value="Indent must use tab characters"/>
<property name="ignoreComments" value="true"/>
</module>

<!--No trailing whitespace-->
<module name="NoWhitespaceAfter" />

<!--When statements consume multiple lines, all lines but the first have two tabs of additional indentation-->
<module name="Indentation">
<property name="arrayInitIndent" value="8" />
<property name="basicOffset" value="8" />
<property name="caseIndent" value="8" />
<property name="lineWrappingIndentation" value="8" />
<property name="throwsIndent" value="8" />
</module>

<!--Each class begins with an empty line-->
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true" />
<property name="tokens"
value="IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF,
ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF,
CTOR_DEF, VARIABLE_DEF, RECORD_DEF, COMPACT_CTOR_DEF" />
</module>

<module name="OneStatementPerLine"/>

<!--Annotations for a structure go on the line before that structure-->
<module name="AnnotationLocation"/>

<!--When splitting Strings into multiple lines the last part of the string must be (space character included) " " +-->
<module name="OperatorWrap">
<property name="option" value="eol" />
<property name="tokens" value="PLUS" />
</module>

<!--Class names are written in UpperCamelCase-->
<module name="TypeName"/>

<!--Methods named in camelCase-->
<module name="MethodName"/>

<!--Static constant fields should be named in UPPER_SNAKE_CASE-->
<module name="ConstantName"/>

<!--We use JetBrains Annotations for specifying null-ness-->
<module name="IllegalImport">
<property name="illegalClasses"
value="javax.annotation.Nonnull,
javax.annotation.Nullable,
org.eclipse.jdt.annotation.NonNull,
org.eclipse.jdt.annotation.Nullable,
org.eclipse.sisu.Nullable,
org.checkerframework.checker.nullness.qual.NonNull,
org.checkerframework.checker.nullness.qual.Nullable" />
<property name="illegalPkgs" value="" />
</module>

<!--Modules for code improvements-->
<module name="MissingOverride"/>
<module name="EmptyBlock"/>
<module name="HideUtilityClassConstructor"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="UnusedLocalVariable"/>

</module>

</module>
1 change: 1 addition & 0 deletions code-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ If we need to remove or alter contributed code due to a licensing issue we will
- The exception to this is breaking up conditional statements (e.g. `if (x || y)`) where the
condition starts may be aligned
* Each class begins with an empty line
* Each Java file ends with an empty line
* No squeezing of multiple lines of code on a single line
* Separate method declarations with empty lines
- Empty line after last method in a class is *not* required
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.parallel=true

groupid=ch.njol
name=skript
version=2.9.2
version=2.9.4
jarName=Skript.jar
testEnv=java21/paper-1.21.0
testEnv=java21/paper-1.21.3
testEnvJavaVersion=21
2 changes: 1 addition & 1 deletion skript-aliases
Loading

0 comments on commit a3ea7f0

Please sign in to comment.