chore: enable CPD detection (pmd.cpd.min → 100), de-dup and baseline#1397
Merged
Merged
Conversation
5f1c381 to
d45faf3
Compare
d45faf3 to
b4bfa9d
Compare
b4bfa9d to
9e73c19
Compare
9e73c19 to
92e68f5
Compare
joaodinissf
commented
Jul 11, 2026
| builder.append("import com.avaloq.tools.ddk.xtext.formatting.ExtendedLineEntry"); | ||
| builder.newLine(); | ||
| // CPD-OFF — parallel Xtend/Java formatter-stub emission, kept explicit (#1339) | ||
| builder.append("import java.util.List"); |
Collaborator
Author
There was a problem hiding this comment.
I will coalesce these in a follow-up PR.
…aseline
pmd.cpd.min=100000 effectively disabled PMD's copy/paste detector: cpd-check
passed on virtually any duplication. Lower the threshold to 100 (PMD's
default) so CPD detects duplication going forward.
At 100 the reactor surfaces pre-existing duplications; each was assessed
for whether it is genuinely extractable logic or incidental/deliberate
similarity:
- Refactored: the identical isExtensionUpdateRequired guard chain in the
Check validator/quickfix extension helpers lifted to
AbstractCheckExtensionHelper (keyed on getExtensionPointId() plus a new
protected getTargetClassName() hook); the identical private
featureIterable helper in Abstract{,Streaming}FingerprintComputer
extracted to a shared package-private FingerprintFeatures utility.
- Baselined with per-site CPD-OFF markers and reasons: test scaffolding in
AbstractValidationTest, sibling test cases in ParameterListMatcherTest,
incidental token overlap in DispatchingCheckImpl, migrated Xtend
dispatch/emission code in FormatJvmModelInferrer (file-scoped) and
FormatFragment2, and sibling test-class scaffolding in the two CheckCfg
test classes.
The lifted guard chain keeps the overrides' public visibility: the hook is
deliberately public so tests can exercise it directly on injected helpers.
Full-reactor pmd:cpd-check is clean at threshold 100.
Closes dsldevkit#1339.
92e68f5 to
76f62b9
Compare
This was referenced Jul 11, 2026
rubenporras
approved these changes
Jul 13, 2026
joaodinissf
added a commit
that referenced
this pull request
Jul 13, 2026
Enabling CPD (#1397, pmd.cpd.min 100000->100) and migrating the AnnotationAware ANTLR generators to Java (#1429) each passed CI in isolation, but their combination on master surfaced 4 intra-file duplications in the migrated generators that neither PR's build saw: CPD was still effectively disabled when #1429's checks ran, and #1397's baseline predated #1429's Java. The snapshot full scan caught it, leaving master red at cpd-check. These are faithfully migrated Xtend generators with parallel rule-emission structure, baselined with file-scoped CPD-OFF markers consistent with #1397's treatment of the analogous FormatJvmModelInferrer. Verified locally: pmd:cpd-check / checkstyle:check / pmd:check all green on com.avaloq.tools.ddk.xtext.generator. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1339.
Problem
ddk-parent/pom.xmlsetpmd.cpd.min=100000, which effectively disables PMD's copy/paste detector —pmd:cpd-checkpasses on virtually any duplication (#1339).What this does
pmd.cpd.minto 100 (PMD's default), so CPD actually detects duplication going forward.// CPD-OFFmarkers carrying a per-site reason.clean verify checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check spotbugs:check) → BUILD SUCCESS,pmd:cpd-checkclean across the full reactor at threshold 100.Dispositions
AbstractValidationTest(test core)ParameterListMatcherTest(typesystem test)testForceMatchByPosition*cases share an arrange-act-assert skeleton, kept explicit for readability.Check{Validator,Quickfix}ExtensionHelper(prod UI)isExtensionUpdateRequiredguard chain lifted toAbstractCheckExtensionHelper, keyed on the existinggetExtensionPointId()plus a newprotected getTargetClassName()hook. The documentation-helper subtree (no target class) declares that hook unsupported once in its shared parent.DispatchingCheckImpl(prod runtime)Abstract{,Streaming}FingerprintComputer(prod)featureIterablehelper extracted to a shared package-privateFingerprintFeaturesutility.FormatJvmModelInferrer(prod, migrated)FormatFragment2(prod generator, migrated)CheckCfg{ContentAssist,ConfiguredParameterValidations}Test@Overridesetup scaffolding, kept explicit per class.Notes
isExtensionUpdateRequiredoverrides keep theirpublicvisibility: the hook is deliberately public so tests can exercise it directly on injected helpers; fix: make isExtensionUpdateRequired uniformly public (widen over narrow) #1460 makes the whole hierarchy uniformly public.cpd.xml→SARIF transform is a possible follow-up.maven-verify'spmd:cpd-check; once ci: fast static analysis with early-fail lint + inline SARIF (PMD/Checkstyle/SpotBugs) #1396's lint lane lands, its CPD gate becomes meaningful too (its "threshold currently very high" note can then be dropped).Merge chain:
#1399(merged) → #1396 → #1400 → #1456 → #1457 → #1397 (this PR)🤖 Generated with Claude Code