Skip to content

Conversation

@ciaranmooney
Copy link
Contributor

@ciaranmooney ciaranmooney commented Oct 19, 2025

Calling diff-pmd.jar with a git-dir path which had relative elements ("." or "..") would cause files with violations to pass the PMD checks.

This was caused by the DiffLineFilter diffEntry.getAbsoluteNewPath() String not matching the violation.getFilename(). It seems that the RuleViolation getFilename uses the unique Canonical paths but the File getAbsolutePath is the non-unique Abstract path. Eg. "/some/directory/file" vs "/some/directory/./file" (or "/some/../some/directory/file").

The DiffCalculatorTest was updated as the file equality was comparing by abstract paths and subsequently failing on Windows. This was due to Windows truncating file paths (C:\Users\CiaranMooney\file vs C:\Users\CiaranM~1\file).

Also, turns out Edit instances of different types are really easy to create. So I thought I'd remove the mocking for an actual instance.

@yangziwen
Copy link
Owner

yangziwen commented Oct 21, 2025

Thanks for your efforts to improving this project :-) @ciaranmooney

@yangziwen yangziwen merged commit 978b617 into yangziwen:master Oct 21, 2025
2 checks passed
@ciaranmooney
Copy link
Contributor Author

Thanks for your efforts to improving this project :-) @ciaranmooney

Your welcome ... but wait! There's more! - #22

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.

2 participants