refactor: decompose god-classes, add lint gates, restructure packages
- Decompose all 11 god-classes (>200 lines) into facade + collaborators (command/, schematic/, config/, generator/, mode/, papi/, adaptive/, storage/, player/, leaderboard/) — every file is now <=200 lines - Add PMD 7 (report-only) + stricter checkstyle rules (NPath, IllegalCatch, NestedDepth, Whitespace, MissingOverride); fix real bugs found (printStackTrace, resource leaks in ConfigLoader/SQLStatsStorage) - docs/ARCHITECTURE.md: target structure + 'one folder = one purpose' rule - Pilot restructure: command/core|util/, mode/impl/solo|multi|barrier/, hook/papi/resolver/; cross-package classes made public - TODO.md: track warning cleanup (132-138) + restructure progress
This commit is contained in:
parent
1d57972038
commit
81788e71ed
70 changed files with 3428 additions and 1701 deletions
|
|
@ -12,6 +12,19 @@
|
|||
<property name="fileNamePattern" value=".*[\\/]src[\\/]test[\\/].*"/>
|
||||
</module>
|
||||
|
||||
<!-- Max file size: enforces the 200-line-per-file rule (KISS / decoupling). -->
|
||||
<module name="FileLength">
|
||||
<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="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="SuppressWarningsFilter"/>
|
||||
|
||||
<module name="LineLength">
|
||||
|
|
@ -85,5 +98,67 @@
|
|||
<module name="NoFinalizer"/>
|
||||
<module name="NoClone"/>
|
||||
<module name="PackageDeclaration"/>
|
||||
|
||||
<!-- ============ Complexity and size ============ -->
|
||||
<module name="NPathComplexity">
|
||||
<property name="max" value="50"/>
|
||||
</module>
|
||||
<module name="NestedIfDepth">
|
||||
<property name="max" value="3"/>
|
||||
</module>
|
||||
<module name="NestedForDepth">
|
||||
<property name="max" value="2"/>
|
||||
</module>
|
||||
<module name="NestedTryDepth">
|
||||
<property name="max" value="2"/>
|
||||
</module>
|
||||
<module name="ClassDataAbstractionCoupling">
|
||||
<property name="max" value="7"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="ClassFanOutComplexity">
|
||||
<property name="max" value="10"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<!-- ============ Safety and reliability ============ -->
|
||||
<module name="MagicNumber">
|
||||
<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"/>
|
||||
<property name="illegalPattern" value="true"/>
|
||||
<property name="message" value="Use a logger instead of System.out/err"/>
|
||||
</module>
|
||||
<module name="Regexp">
|
||||
<property name="format" value="\.printStackTrace\(\)"/>
|
||||
<property name="illegalPattern" value="true"/>
|
||||
<property name="message" value="Use a logger instead of printStackTrace"/>
|
||||
</module>
|
||||
<module name="IllegalThrows"/>
|
||||
<module name="IllegalCatch">
|
||||
<property name="illegalClassNames"
|
||||
value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException"/>
|
||||
</module>
|
||||
|
||||
<!-- ============ Style and maintainability ============ -->
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="MissingOverride"/>
|
||||
<module name="MissingDeprecated">
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
<module name="FinalLocalVariable">
|
||||
<property name="validateEnhancedForLoopVariable" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
|
|
|
|||
81
config/checkstyle/suppressions.xml
Normal file
81
config/checkstyle/suppressions.xml
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?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[\\/]ConfigUpdater\.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[\\/]DynamicMenu.java"/>
|
||||
<suppress checks="NPathComplexity" files=".*[\\/]menu[\\/]core[\\/]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[\\/]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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue