From 0fe9385fec3fdfb0d8d0132df6da873ac1dc2c5a Mon Sep 17 00:00:00 2001 From: thomasc Date: Thu, 9 Jul 2026 17:59:43 +0200 Subject: [PATCH 1/2] Exclude generated OpenAPI models from SonarCloud coverage metric Context: SonarCloud coverage was being diluted by the generated data model classes under com/adyen/model//** (POJOs, getters/setters, equals/hashCode/toString, and the generated per-package JSON.java mapper config). These are produced by OpenAPI Generator from Adyen's OpenAPI specs via adyen-sdk-automation and are not hand-maintained, so their coverage numbers don't reflect meaningful test gaps. Change: Add sonar.coverage.exclusions=**/com/adyen/model/*/** to pom.xml. This only affects the coverage metric and coverage quality gate in SonarCloud; Sonar still analyzes excluded files for bugs, vulnerabilities, and code smells. Why this glob: - Matches files at least one directory below com/adyen/model/, i.e. the generated per-API packages (model/checkout/**, model/management/**, ...). - Does NOT match the top-level com/adyen/model/*.java files, so the hand-written ApiError.java and RequestOptions.java remain in scope (the generated InvalidField.java also stays in scope; a single trivial file, not worth a more complex exclusion pattern). - Path-based and therefore self-maintaining: any new generated API package added under model/ is automatically excluded going forward. What stays fully in scope for coverage: - com/adyen/serializer/** (ByteArraySerializer, DateSerializer, custom Jackson (de)serializers) - com/adyen/terminal/serialization/** (XML/Base64 type adapters) - com/adyen/service/** (generated services were intentionally left in scope for now) - All other hand-written library code (Client, Service, Config, httpclient, util, security, notification, builders) --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index a675a3af0..015447da4 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ adyen https://sonarcloud.io ${project.build.directory}/site/jacoco/jacoco.xml + **/com/adyen/model/*/** From a82f0adb72ba764fa1fe8eec174eddee7f397574 Mon Sep 17 00:00:00 2001 From: thomasc Date: Thu, 9 Jul 2026 18:05:32 +0200 Subject: [PATCH 2/2] Exclude generated OpenAPI models from SonarCloud duplication (CPD) check Context: The generated model classes under com/adyen/model//** follow a repetitive OpenAPI Generator template (getters/setters, equals/hashCode/ toString, isSet* flags, getExplicitNulls, toJson/fromJson). Sonar's Copy-Paste Detection flags huge numbers of duplicated blocks across these files, e.g. CI run: https://github.com/Adyen/adyen-java-api-library/actions/runs/29031747289/job/86166267497?pr=2002 logged 'Too many duplication references ... Keep only the first 100 references' for hundreds of blocks, all within com/adyen/model/**. This duplication is a byproduct of code generation, not a real maintenance risk, and drowns out genuine duplication signal in hand-written code. Change: Add sonar.cpd.exclusions=**/com/adyen/model/*/** to pom.xml, using the same glob already applied to sonar.coverage.exclusions for consistency. This only removes generated model packages from the duplication metric; Sonar still analyzes them for bugs, vulnerabilities, and code smells, and hand-written code (serializer packages, services, httpclient, etc.) remains fully covered by duplication detection. --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 015447da4..9aa7073e0 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ https://sonarcloud.io ${project.build.directory}/site/jacoco/jacoco.xml **/com/adyen/model/*/** + **/com/adyen/model/*/**