From 74be4214aa674a3471f1d304f370723588925cb5 Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Thu, 6 Aug 2026 17:53:23 +0200 Subject: [PATCH] chore: revert Lavalink timeout to 30s, add PMD + stricter checkstyle - LavalinkManager: httpTimeout back to 30s (stagger delays are the real fix) - checkstyle: comprehensive ruleset from LoParkour (200-line files, complexity, naming) - PMD: ruleset with CognitiveComplexity, CloseResource, TooManyMethods etc - Both tools run with ignoreFailures=true (warnings only, don't block build) --- build.gradle | 7 + config/checkstyle/checkstyle.xml | 223 ++++++++++-------- config/checkstyle/suppressions.xml | 38 +++ config/pmd/ruleset.xml | 124 +++------- .../feature/music/core/LavalinkManager.java | 2 +- 5 files changed, 208 insertions(+), 186 deletions(-) create mode 100644 config/checkstyle/suppressions.xml diff --git a/build.gradle b/build.gradle index c262402..05f9dd7 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'application' id 'checkstyle' + id 'pmd' alias(libs.plugins.spotbugs) id 'com.diffplug.spotless' version '6.25.0' } @@ -78,6 +79,12 @@ checkstyle { ignoreFailures = true } +pmd { + ruleSets = [] + ruleSetFiles = files("${rootDir}/config/pmd/ruleset.xml") + ignoreFailures = true +} + spotbugs { excludeFilter = file("${rootDir}/config/spotbugs/exclude.xml") ignoreFailures = false diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 5b25313..e283fdb 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -1,103 +1,150 @@ - - + + + - + - - + + + + + + + + - - - - - - + - - - - + + + + + - - - + + + - - - + + + - - + + + + + + + - - + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -106,25 +153,5 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 0000000..7295c20 --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/pmd/ruleset.xml b/config/pmd/ruleset.xml index 5eaeaba..c64ce13 100644 --- a/config/pmd/ruleset.xml +++ b/config/pmd/ruleset.xml @@ -1,95 +1,45 @@ - - + + + xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.io/ruleset_2_0_0.xsd"> - PMD rules for Loki Discord Bot + + PMD rules complementing checkstyle. Adds checks checkstyle does not + cover: resource leaks, string ==, empty control flow, god-class/size + hints and complexity. + UnusedImports is excluded (handled by checkstyle). + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + diff --git a/src/main/java/creator/loki/feature/music/core/LavalinkManager.java b/src/main/java/creator/loki/feature/music/core/LavalinkManager.java index 5e8b355..2438650 100644 --- a/src/main/java/creator/loki/feature/music/core/LavalinkManager.java +++ b/src/main/java/creator/loki/feature/music/core/LavalinkManager.java @@ -55,7 +55,7 @@ public class LavalinkManager { .setName("main") .setServerUri(lavalinkConfig.getWsUri()) .setPassword(lavalinkConfig.getPassword()) - .setHttpTimeout(60000L) + .setHttpTimeout(30000L) .build()); registerListeners();