build: two-tier checkstyle gate, empty suppressions, fix baseline

Checkstyle is now a ratchet: severity="error" only for rules that are at
zero violations, design-debt rules report as warnings and must be flipped
to error as soon as their backlog hits zero (tracked in TODO.md).

- thresholds tightened: MethodLength 80->40, CyclomaticComplexity 20->15,
  NestedIfDepth 3->2, ParameterNumber 7->5; new rules ReturnCount(5),
  FinalClass, HiddenField, VisibilityModifier; MagicNumber and
  FinalLocalVariable promoted from warning to error (both clean)
- suppressions.xml emptied: 45 legacy entries removed, never add back
- fixed 102 baseline violations (431->329): FinalClass in 37 classes,
  WhitespaceAround in 11 files
- TODO.md: Task 1 done (lolib removed, smoke test passed) and Task 2
  baseline recorded (red report, per-package list, next steps)
This commit is contained in:
loki5512344 2026-10-06 14:17:14 +02:00
parent 4d999c89a8
commit e8b6569ccf
Signed by: boba
GPG key ID: 253067914055423B
46 changed files with 279 additions and 147 deletions

View file

@ -3,6 +3,24 @@
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Two-tier gate (ratchet):
* severity="error" — rules that are at ZERO violations right now. The build
fails if any of them fires. Strict thresholds live here; they were raised
from the pre-Task-2 values (MethodLength 80->40, CyclomaticComplexity
20->15, NestedIfDepth 3->2, ParameterNumber 7->5, MagicNumber and
FinalLocalVariable promoted from warning to error).
* severity="warning" — the design-debt backlog: rules that are ON and report
every violation in build/reports/checkstyle, but do not fail the build
while their backlog is non-zero. Counts are tracked in TODO.md
(Задача 2, блок «красный baseline»). When a rule reaches zero violations
it MUST be flipped to severity="error" in this file.
suppressions.xml is intentionally empty — never add entries back; fix the
code or, for a documented intentional pattern, agree on it with the owner.
-->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
@ -17,11 +35,8 @@
<property name="max" value="200"/>
</module>
<!-- Legacy files that still exceed 200 lines. Remove entries as they get
decomposed; new files must already comply and must NOT be added here. -->
<module name="SuppressionFilter">
<property name="file"
value="${config_loc}/suppressions.xml"/>
<property name="file" value="${config_loc}/suppressions.xml"/>
<property name="optional" value="true"/>
</module>
@ -37,16 +52,23 @@
<module name="SuppressWarningsHolder"/>
<module name="MethodLength">
<property name="max" value="80"/>
<property name="max" value="40"/>
<property name="countEmpty" value="false"/>
<property name="severity" value="warning"/>
</module>
<module name="CyclomaticComplexity">
<property name="max" value="20"/>
<property name="max" value="15"/>
</module>
<module name="ParameterNumber">
<property name="max" value="7"/>
<property name="max" value="5"/>
<property name="severity" value="warning"/>
</module>
<module name="ReturnCount">
<property name="max" value="5"/>
<property name="severity" value="warning"/>
</module>
<module name="AvoidStarImport"/>
@ -86,6 +108,18 @@
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
<module name="OuterTypeFilename"/>
<module name="FinalClass"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="VisibilityModifier">
<property name="allowPublicFinalFields" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="EmptyBlock">
<property name="option" value="text"/>
@ -102,9 +136,10 @@
<!-- ============ Complexity and size ============ -->
<module name="NPathComplexity">
<property name="max" value="50"/>
<property name="severity" value="warning"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="3"/>
<property name="max" value="2"/>
</module>
<module name="NestedForDepth">
<property name="max" value="2"/>
@ -113,11 +148,11 @@
<property name="max" value="2"/>
</module>
<module name="ClassDataAbstractionCoupling">
<property name="max" value="25"/>
<property name="max" value="10"/>
<property name="severity" value="warning"/>
</module>
<module name="ClassFanOutComplexity">
<property name="max" value="30"/>
<property name="max" value="12"/>
<property name="severity" value="warning"/>
</module>
@ -126,7 +161,6 @@
<property name="ignoreNumbers" value="-1, 0, 1, 2"/>
<property name="ignoreHashCodeMethod" value="true"/>
<property name="ignoreAnnotation" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="Regexp">
<property name="format" value="System\.(out|err)\.print"/>
@ -142,6 +176,7 @@
<module name="IllegalCatch">
<property name="illegalClassNames"
value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException"/>
<property name="severity" value="warning"/>
</module>
<!-- ============ Style and maintainability ============ -->
@ -158,7 +193,6 @@
</module>
<module name="FinalLocalVariable">
<property name="validateEnhancedForLoopVariable" value="true"/>
<property name="severity" value="warning"/>
</module>
</module>
</module>

View file

@ -1,88 +1,3 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<!--
Suppressions for legacy files that violate the stricter rules:
- FileLength (200-line limit),
- IllegalCatch (no catch of Exception/Throwable/RuntimeException),
- NPathComplexity (<= 50) and WhitespaceAround.
Legacy files are scheduled for decomposition / cleanup (see docs/ARCHITECTURE.md).
Remove each entry once the file complies on its own.
New files must already comply with ALL rules and must NOT be added here —
EXCEPT two documented defensive boundary catches (see below).
NOTE: the noisy MagicNumber/FinalLocalVariable rules are kept at
severity="warning", so they do not need suppressions.
-->
<suppressions>
<!-- ===== FileLength (200 lines) ===== -->
<!--
===== Intentional defensive boundary catches =====
These are NOT swallowing exceptions:
- LoParkourCommand.onCommand: catches Throwable at the command entry point,
logs the full stack trace and notifies the player (never silent).
- ConfigUpdater: catches Exception to roll back to the backup copy and
rethrows — transactional semantics, the exception is not swallowed.
Do not remove without a review of the intended behavior.
-->
<suppress checks="IllegalCatch" files=".*[\\/]command[\\/]core[\\/]LoParkourCommand\.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]config[\\/]core[\\/]merge[\\/]ConfigUpdater\.java"/>
<!--
SchematicManager: catches RuntimeException so a corrupted/truncated schematic
(WorldEdit/Bukkit throw unchecked exceptions) is skipped instead of breaking
plugin enable. Not swallowing — the failure is logged at SEVERE with the cause.
-->
<suppress checks="IllegalCatch" files=".*[\\/]schematic[\\/]core[\\/]SchematicManager\.java"/>
<!-- ===== IllegalCatch / NPathComplexity / WhitespaceAround (legacy debt) ===== -->
<suppress checks="IllegalCatch" files=".*[\\/]LoParkour.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]adaptive[\\/]bootstrap[\\/]AdaptiveServices.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]bootstrap[\\/]PluginBootstrap.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]command[\\/]player[\\/]PlayerCommandHandler.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]config[\\/]core[\\/]ConfigLoader.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]config[\\/]locale[\\/]LocaleCache.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]config[\\/]locale[\\/]LocaleLoader.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]config[\\/]options[\\/]OptionGeneral.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]generator[\\/]core[\\/]coordinator[\\/]GeneratorProfileManager.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]generator[\\/]core[\\/]model[\\/]GeneratorState.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]generator[\\/]effect[\\/]EffectManager.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]generator[\\/]jump[\\/]calculation[\\/]JumpDirector.java"/>
<suppress checks="IllegalCatch|NPathComplexity" files=".*[\\/]generator[\\/]jump[\\/]calculation[\\/]JumpValidator.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]generator[\\/]jump[\\/]placement[\\/]BlockSelector.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]generator[\\/]lifecycle[\\/]loop[\\/]LifecycleEventManager.java"/>
<suppress checks="NPathComplexity|WhitespaceAround" files=".*[\\/]generator[\\/]lifecycle[\\/]player[\\/]GeneratorCleanup.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]hook[\\/]floodgate[\\/]FloodgateHook.java"/>
<suppress checks="IllegalCatch|NPathComplexity|WhitespaceAround" files=".*[\\/]hook[\\/]holo[\\/]HoloHook.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]hook[\\/]vault[\\/]VaultHook.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]leaderboard[\\/]core[\\/]LeaderboardSorter.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]listener[\\/]gameplay[\\/]ParkourRestrictionListener.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]listener[\\/]schematic[\\/]SchematicWandListener.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]community[\\/]LeaderboardsMenu.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]community[\\/]SingleLeaderboardMenu.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]menu[\\/]core[\\/]screen[\\/]DynamicMenu\.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]core[\\/]screen[\\/]MainMenu\.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]menu[\\/]core[\\/]MenuStub.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]lobby[\\/]LobbyMenu.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]lobby[\\/]PlayerManagementMenu.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]play[\\/]SingleMenu.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]play[\\/]SpectatorMenu.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]mode[\\/]impl[\\/]solo[\\/]GravityShiftMode\.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]player[\\/]data[\\/]InventoryData.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]player[\\/]data[\\/]PreviousData.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]player[\\/]service[\\/]ui[\\/]ScoreboardManager\.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]player[\\/]service[\\/]UserRegistry.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]reward[\\/]core[\\/]Reward.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]session[\\/]manager[\\/]SessionStateManager.java"/>
<suppress checks="IllegalCatch" files=".*[\\/]storage[\\/]sql[\\/]SQLConnectionManager.java"/>
<suppress checks="WhitespaceAround" files=".*[\\/]storage[\\/]sql[\\/]SQLDataMapper.java"/>
<suppress checks="NPathComplexity|WhitespaceAround" files=".*[\\/]util[\\/]item[\\/]Materials.java"/>
<suppress checks="NPathComplexity" files=".*[\\/]world[\\/]core[\\/]World.java"/>
</suppressions>
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions/>