Skip to content

chore: exclude generated binding classes from PMD and CPD checks#622

Merged
david-waltermire merged 1 commit intometaschema-framework:developfrom
david-waltermire:chore/exclude-generated-bindings-from-pmd
Jan 6, 2026
Merged

chore: exclude generated binding classes from PMD and CPD checks#622
david-waltermire merged 1 commit intometaschema-framework:developfrom
david-waltermire:chore/exclude-generated-bindings-from-pmd

Conversation

@david-waltermire
Copy link
Contributor

@david-waltermire david-waltermire commented Jan 6, 2026

Summary

  • Add PMD excludes for generated binding classes in databind and metaschema-testing modules
  • These classes are auto-generated from Metaschema modules and should not be subject to static analysis

Changes

databind/pom.xml:

  • Exclude **/dev/metaschema/databind/model/metaschema/binding/*.java
  • Exclude **/dev/metaschema/databind/config/binding/*.java

metaschema-testing/pom.xml:

  • Exclude **/dev/metaschema/model/testing/testsuite/**/*.java

Test plan

  • Verified generated binding classes no longer appear in PMD reports
  • Verified generated binding classes no longer appear in CPD reports
  • Exclusion patterns match existing Checkstyle excludes in the same modules

Summary by CodeRabbit

  • Chores
    • Updated build tool configurations to exclude generated code from static analysis checks. This refines code quality processes to focus on manually written code, improving analysis accuracy and reducing noise in development workflows.

✏️ Tip: You can customize this high-level summary in your review settings.

Add PMD excludes for generated binding classes that were being flagged
for code style violations and duplicate code detection. These classes
are auto-generated from Metaschema modules and should not be subject
to static analysis.

Excluded packages:
- databind: model/metaschema/binding and config/binding
- metaschema-testing: model/testing/testsuite
@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

Two Maven build configuration files are updated to exclude generated binding source files from PMD and CPD static analysis checks. Exclusion patterns are added to skip generated code in both the databind module and metaschema-testing module.

Changes

Cohort / File(s) Summary
Maven PMD Plugin Exclusions
databind/pom.xml, metaschema-testing/pom.xml
Add <excludes> blocks to maven-pmd-plugin configuration in both files to skip PMD and CPD analyses on generated binding classes. databind excludes dev/metaschema/databind/model/metaschema/binding/*.java and dev/metaschema/databind/config/binding/*.java; metaschema-testing excludes dev/metaschema/model/testing/testsuite/**/*.java.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 Hopping through configs, we prune and we exclude,
Generated bindings need not be reviewed,
PMD can rest, CPD can sleep sound,
While clean code logic hops safely around. 🌿

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: excluding generated binding classes from PMD and CPD checks, which matches the primary purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ea14e1 and 85a1c1e.

📒 Files selected for processing (2)
  • databind/pom.xml
  • metaschema-testing/pom.xml
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/csrc/ns/metaschema/test_suite/_1_0/Metaschema.java:41-47
Timestamp: 2025-12-24T21:21:40.208Z
Learning: In metaschema-framework/metaschema-java, generated binding classes in package gov.nist.csrc.ns.metaschema.test_suite._1_0 (and similar generated binding packages) are pre-generated by metaschema-maven-plugin and checked into source control. Javadoc coverage issues in these generated classes should be tracked as code generator improvements rather than file-level issues, and improvements are deferred to generator enhancements.
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/secauto/metaschema/model/testing/testsuite/Metaschema.java:41-47
Timestamp: 2025-12-24T21:21:56.361Z
Learning: In metaschema-testing, generated binding classes under gov.nist.secauto.metaschema.model.testing.testsuite are produced by metaschema-maven-plugin from YAML metaschema definitions. Javadoc issues in these generated classes should not be flagged for manual fixes; improvements are tracked and handled through code generator enhancements rather than manual edits to the generated source.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to **/*.{xmlbeans,antlr} : Generated code in *.xmlbeans and *.antlr packages is excluded from Javadoc and style checks. Generated sources are placed in target/generated-sources/
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/secauto/metaschema/model/testing/testsuite/GenerationCase.java:74-80
Timestamp: 2025-12-24T21:22:07.082Z
Learning: Files in the package gov.nist.secauto.metaschema.model.testing.testsuite in metaschema-testing are generated binding classes created from Metaschema definitions. Documentation and style improvements for these files should be made at the code generator level (metaschema-maven-plugin) rather than by manually editing the generated code.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to core/metaschema/schema/xml/** : XMLBeans code is generated from XSD schemas in core/metaschema/schema/xml during Maven build. Generated sources are placed in target/generated-sources/
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Use SpotBugs, PMD, Checkstyle, and Jacoco for static analysis. Project enforces Checkstyle code style, PMD source analysis (fails on priority 2+ violations), SpotBugs bug detection (with spotbugs-exclude.xml exclusions), and Jacoco code coverage (target: 60% coverage)
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 605
File: databind/src/main/java/gov/nist/secauto/metaschema/databind/codegen/typeinfo/DefaultMetaschemaClassFactory.java:480-484
Timestamp: 2025-12-30T04:19:49.192Z
Learning: In metaschema-framework/metaschema-java, when users configure custom superinterfaces via binding configuration, david-waltermire prefers both documentation (explaining how to add dependencies to the Maven plugin) and validation mechanisms (warnings when classes aren't on classpath) to prevent redundant IBoundObject interface additions during code generation.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to core/src/main/antlr4/** : Metapath parser is generated from ANTLR4 grammar files in core/src/main/antlr4. Code generation occurs during Maven build producing output in target/generated-sources/
📚 Learning: 2025-12-24T21:21:56.361Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/secauto/metaschema/model/testing/testsuite/Metaschema.java:41-47
Timestamp: 2025-12-24T21:21:56.361Z
Learning: In metaschema-testing, generated binding classes under gov.nist.secauto.metaschema.model.testing.testsuite are produced by metaschema-maven-plugin from YAML metaschema definitions. Javadoc issues in these generated classes should not be flagged for manual fixes; improvements are tracked and handled through code generator enhancements rather than manual edits to the generated source.

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2025-12-24T21:21:40.208Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/csrc/ns/metaschema/test_suite/_1_0/Metaschema.java:41-47
Timestamp: 2025-12-24T21:21:40.208Z
Learning: In metaschema-framework/metaschema-java, generated binding classes in package gov.nist.csrc.ns.metaschema.test_suite._1_0 (and similar generated binding packages) are pre-generated by metaschema-maven-plugin and checked into source control. Javadoc coverage issues in these generated classes should be tracked as code generator improvements rather than file-level issues, and improvements are deferred to generator enhancements.

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2025-12-24T21:22:07.082Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/secauto/metaschema/model/testing/testsuite/GenerationCase.java:74-80
Timestamp: 2025-12-24T21:22:07.082Z
Learning: Files in the package gov.nist.secauto.metaschema.model.testing.testsuite in metaschema-testing are generated binding classes created from Metaschema definitions. Documentation and style improvements for these files should be made at the code generator level (metaschema-maven-plugin) rather than by manually editing the generated code.

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2025-12-17T13:27:43.679Z
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to **/*.{xmlbeans,antlr} : Generated code in *.xmlbeans and *.antlr packages is excluded from Javadoc and style checks. Generated sources are placed in target/generated-sources/

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2025-12-30T04:19:49.192Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 605
File: databind/src/main/java/gov/nist/secauto/metaschema/databind/codegen/typeinfo/DefaultMetaschemaClassFactory.java:480-484
Timestamp: 2025-12-30T04:19:49.192Z
Learning: In metaschema-framework/metaschema-java, when users configure custom superinterfaces via binding configuration, david-waltermire prefers both documentation (explaining how to add dependencies to the Maven plugin) and validation mechanisms (warnings when classes aren't on classpath) to prevent redundant IBoundObject interface additions during code generation.

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2025-12-17T13:27:43.679Z
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to core/metaschema/schema/xml/** : XMLBeans code is generated from XSD schemas in core/metaschema/schema/xml during Maven build. Generated sources are placed in target/generated-sources/

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2026-01-05T16:08:37.155Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 618
File: core/src/main/java-templates/dev/metaschema/core/MetaschemaJavaVersion.java:2-2
Timestamp: 2026-01-05T16:08:37.155Z
Learning: In metaschema-framework/metaschema-java, the canonical Java package naming convention is dev.metaschema.* (renamed from gov.nist.secauto.metaschema.* as of PR #618).

Applied to files:

  • metaschema-testing/pom.xml
📚 Learning: 2026-01-05T18:03:33.537Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 618
File: core/src/main/java/dev/metaschema/core/datatype/package-info.java:52-52
Timestamp: 2026-01-05T18:03:33.537Z
Learning: In metaschema-framework/metaschema-java, CLAUDE.md is the canonical coding-guidelines document and now specifies dev.metaschema.* as the Java package convention (updated in PR #618).

Applied to files:

  • metaschema-testing/pom.xml
📚 Learning: 2026-01-05T16:33:59.206Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 0
File: :0-0
Timestamp: 2026-01-05T16:33:59.206Z
Learning: In metaschema-framework/metaschema-java, the core/metaschema submodule is owned by this project's maintainers; updates to it are coordinated within this repository, so no follow-up issues should be opened in external repositories for submodule changes.

Applied to files:

  • metaschema-testing/pom.xml
📚 Learning: 2026-01-05T18:03:23.064Z
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 618
File: core/src/main/java/dev/metaschema/core/metapath/format/IPathSegment.java:0-0
Timestamp: 2026-01-05T18:03:23.064Z
Learning: In metaschema-framework/metaschema-java, avoid duplicating SpotBugs nullability annotations on overrides when the superinterface (e.g., dev.metaschema.core.model.IMetapathQueryable#getNodeItem()) already declares the null contract; rely on the inherited annotation instead.

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
📚 Learning: 2025-12-17T13:27:43.679Z
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Use SpotBugs, PMD, Checkstyle, and Jacoco for static analysis. Project enforces Checkstyle code style, PMD source analysis (fails on priority 2+ violations), SpotBugs bug detection (with spotbugs-exclude.xml exclusions), and Jacoco code coverage (target: 60% coverage)

Applied to files:

  • metaschema-testing/pom.xml
  • databind/pom.xml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Code
  • GitHub Check: Website
🔇 Additional comments (2)
metaschema-testing/pom.xml (1)

76-79: LGTM! PMD exclusions correctly configured for generated test binding classes.

The exclusion pattern properly aligns with the existing Checkstyle exclusion on line 58 and correctly targets the generated binding classes under dev/metaschema/model/testing/testsuite.

Based on learnings about generated binding classes in metaschema-testing module.

databind/pom.xml (1)

106-110: Fix JaCoCo exclusion path to match actual generated binding class structure.

The JaCoCo exclusion at lines 133-134 uses the wrong path order. The pattern dev/metaschema/databind/model/binding/metaschema/* won't match the actual generated binding classes located at dev/metaschema/databind/model/metaschema/binding/. This path order mismatch (binding/metaschema vs. metaschema/binding) means JaCoCo won't exclude generated code from coverage metrics as intended.

Update line 133 from:

<exclude>dev/metaschema/databind/model/binding/metaschema/*</exclude>

to:

<exclude>dev/metaschema/databind/model/metaschema/binding/*</exclude>

This aligns with the PMD and Checkstyle exclusion patterns already in place and matches the actual directory structure.

⛔ Skipped due to learnings
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/csrc/ns/metaschema/test_suite/_1_0/Metaschema.java:41-47
Timestamp: 2025-12-24T21:21:40.208Z
Learning: In metaschema-framework/metaschema-java, generated binding classes in package gov.nist.csrc.ns.metaschema.test_suite._1_0 (and similar generated binding packages) are pre-generated by metaschema-maven-plugin and checked into source control. Javadoc coverage issues in these generated classes should be tracked as code generator improvements rather than file-level issues, and improvements are deferred to generator enhancements.
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/secauto/metaschema/model/testing/testsuite/GenerationCase.java:74-80
Timestamp: 2025-12-24T21:22:07.082Z
Learning: Files in the package gov.nist.secauto.metaschema.model.testing.testsuite in metaschema-testing are generated binding classes created from Metaschema definitions. Documentation and style improvements for these files should be made at the code generator level (metaschema-maven-plugin) rather than by manually editing the generated code.
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 567
File: metaschema-testing/src/main/java/gov/nist/secauto/metaschema/model/testing/testsuite/Metaschema.java:41-47
Timestamp: 2025-12-24T21:21:56.361Z
Learning: In metaschema-testing, generated binding classes under gov.nist.secauto.metaschema.model.testing.testsuite are produced by metaschema-maven-plugin from YAML metaschema definitions. Javadoc issues in these generated classes should not be flagged for manual fixes; improvements are tracked and handled through code generator enhancements rather than manual edits to the generated source.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to **/*.{xmlbeans,antlr} : Generated code in *.xmlbeans and *.antlr packages is excluded from Javadoc and style checks. Generated sources are placed in target/generated-sources/
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 618
File: core/src/main/java/dev/metaschema/core/metapath/format/IPathSegment.java:0-0
Timestamp: 2026-01-05T18:03:23.064Z
Learning: In metaschema-framework/metaschema-java, avoid duplicating SpotBugs nullability annotations on overrides when the superinterface (e.g., dev.metaschema.core.model.IMetapathQueryable#getNodeItem()) already declares the null contract; rely on the inherited annotation instead.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to **/metapath/**/*.java : Metapath is an implementation of XPath 3.1. Use the XPath 3.1 specification (https://www.w3.org/TR/xpath-31/) and XPath Functions 3.1 (https://www.w3.org/TR/xpath-functions-31/) as authoritative reference when implementing new functions, fixing bugs, or understanding error handling. Raise clarification before making changes if implementation differs from spec.
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 605
File: databind/src/main/java/gov/nist/secauto/metaschema/databind/codegen/typeinfo/DefaultMetaschemaClassFactory.java:480-484
Timestamp: 2025-12-30T04:19:49.192Z
Learning: In metaschema-framework/metaschema-java, when users configure custom superinterfaces via binding configuration, david-waltermire prefers both documentation (explaining how to add dependencies to the Maven plugin) and validation mechanisms (warnings when classes aren't on classpath) to prevent redundant IBoundObject interface additions during code generation.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Applies to core/metaschema/schema/xml/** : XMLBeans code is generated from XSD schemas in core/metaschema/schema/xml during Maven build. Generated sources are placed in target/generated-sources/
Learnt from: david-waltermire
Repo: metaschema-framework/metaschema-java PR: 605
File: databind/src/main/java/gov/nist/secauto/metaschema/databind/codegen/typeinfo/DefaultMetaschemaClassFactory.java:508-512
Timestamp: 2025-12-30T19:01:32.147Z
Learning: DefaultMetaschemaClassFactory.extendsIBoundObject logs a warning when a configured superinterface cannot be loaded from the classpath during code generation, advising users to add the class as a Maven plugin dependency to avoid redundant IBoundObject additions.
Learnt from: CR
Repo: metaschema-framework/metaschema-java PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T13:27:43.679Z
Learning: Use SpotBugs, PMD, Checkstyle, and Jacoco for static analysis. Project enforces Checkstyle code style, PMD source analysis (fails on priority 2+ violations), SpotBugs bug detection (with spotbugs-exclude.xml exclusions), and Jacoco code coverage (target: 60% coverage)

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PMD (7.19.0)
metaschema-testing/pom.xml

[ERROR] Cannot load ruleset pmd/category/java/custom.xml: Cannot resolve rule/ruleset reference 'pmd/category/java/custom.xml'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath.
[WARN] Progressbar rendering conflicts with reporting to STDOUT. No progressbar will be shown. Try running with argument -r to output the report to a file instead.

databind/pom.xml

[ERROR] Cannot load ruleset pmd/category/java/custom.xml: Cannot resolve rule/ruleset reference 'pmd/category/java/custom.xml'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath.
[WARN] Progressbar rendering conflicts with reporting to STDOUT. No progressbar will be shown. Try running with argument -r to output the report to a file instead.


Comment @coderabbitai help to get the list of available commands and usage tips.

@david-waltermire david-waltermire added this to the v3.0.0 Milestone 2 milestone Jan 6, 2026
@david-waltermire david-waltermire merged commit 3ef8573 into metaschema-framework:develop Jan 6, 2026
6 checks passed
@david-waltermire david-waltermire deleted the chore/exclude-generated-bindings-from-pmd branch January 6, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant