-
-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added checkstyle for Skript code conventions * removed the check for short field names and required braces for code blocks * added GitHub workflow for checkstyle disabled checkstyle check running after `build` task changed severity of code violations to warning * added information about empty lines at the end of the java files to the code conventions * added artifact upload for the checkstyle reports * Update code-conventions.md Co-authored-by: Efy <35348263+Efnilite@users.noreply.github.com> --------- Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> Co-authored-by: Efy <35348263+Efnilite@users.noreply.github.com>
- Loading branch information
1 parent
19985d9
commit 03cd121
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters