Affects PMD Version: 6.25.0+
Description:
With 6.25.0 AnyTokenizer now supports columns (b976d65), but the columns are not reset when a new line starts. So the beginColumn/endColumn property is always incrementing...
Code Sample demonstrating the issue:
Create two files file1.txt
and file2.txt
with the following content:
file1.txt
file one:
This is some
duplication.
Some other content.
file2.txt
file2
This is some
duplication.
Something different.
Steps to reproduce:
run.sh cpd --language any --minimum-tokens 4 --format xml --files file1.txt file2.txt
The output is this:
<?xml version="1.0" encoding="UTF-8"?> <pmd-cpd> <duplication lines="2" tokens="4"> <file column="10" endcolumn="33" endline="3" line="2" path="/.../file1.txt"/> <file column="6" endcolumn="33" endline="3" line="2" path="/.../file2.txt"/> <codefragment><![CDATA[This is some duplication.]]></codefragment> </duplication> </pmd-cpd>
The begin column should be for both occurrences "1", the endcolumn in file 1 should be 12 and in file 2 it should be 16.
Running PMD through: CLI
I guess, we simply need to reset the var colNumber
at
Maybe we can also leverage the new tokenizer test method ("CpdTextComparisonTest") for the AnyTokenizer.
Relates to #2758
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4