-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Linting Exception Audit
Audit from wphillipmoore/mq-rest-admin-common#118.
Current Exceptions (~128 total)
Config-Level
- Checkstyle:
package-info.javaandmodule-info.javaexempt from all checks - PMD ruleset: 22 rules excluded (mostly Design complexity), 4 thresholds raised (CyclomaticComplexity→15, CognitiveComplexity→20, NPathComplexity→300, NestedIf→4)
- JaCoCo: excludes
package-info.class,*IT.class,examples/*.class - Error Prone: NullAway enabled for production, disabled for test code
Source Code Inline (23)
- 21×
@SuppressWarnings("unchecked")— GSON deserialization casts (MappingData: 10, AttributeMapper: 5, MqRestSession: 6) - 2×
@SuppressWarnings("PMD.CloseResource")— justified resource lifecycle management
Test Code Inline (76)
- 76×
@SuppressWarnings("unchecked")— all MockitoArgumentCaptor.forClass(Map.class)type erasure
Actionable Items
1. Eliminate source code unchecked casts via Jackson (~2-3 hrs)
Switch JSON deserialization from GSON to Jackson with TypeReference:
// Before (GSON — requires unchecked cast)
Type mapType = new TypeToken<Map<String, Object>>() {}.getType();
Map<String, Object> data = GSON.fromJson(json, mapType);
// After (Jackson — type-safe, no cast needed)
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> data = mapper.readValue(json,
new TypeReference<Map<String, Object>>() {});Jackson's generic-aware API eliminates the need for @SuppressWarnings("unchecked") at deserialization points.
Eliminates: ~15-21 source code suppressions
Adds: com.fasterxml.jackson.core:jackson-databind dependency
Not Actionable
- 76 test
uncheckedcasts — Mockito'sArgumentCaptor.forClass()API usesClass<T>which cannot express generic types due to Java type erasure. This is an inherent Mockito limitation (verified against Mockito 5.21.0). Refactoring to inline verification would require 6-8 hours for marginal benefit. - 2 PMD.CloseResource — both well-documented and correct (HttpClient lifecycle, InputStreamReader closure chain)
- 22 PMD rule exclusions — all justified (Design complexity rules for dispatcher methods, multithreading rules for managed HTTP clients, style rules for readability). Re-enabling would require 15-20 hours of refactoring with no quality improvement.
- 4 PMD threshold overrides — justified by
mqscCommand()dispatcher complexity and 3-layer mapping pipeline - Checkstyle/JaCoCo config exclusions — standard Java project patterns
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request