diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Mark.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Mark.java index 088da59d39..ab47816341 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Mark.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Mark.java @@ -1,3 +1,6 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.cpd; public class Mark implements Comparable { diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 638ca4b34e..5ca8342881 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -12,6 +12,7 @@ **Feature Requests and Improvements:** * XML: Line numbers for XML documents are more accurate. This is a further improvement of [#1054](https://sourceforge.net/p/pmd/bugs/1054/). +* CPD: New output format 'csv_with_linecount_per_file' **New/Modified Rules:** @@ -24,6 +25,7 @@ * [#15](https://github.com/adangel/pmd/pull/15): (pmd-cs) Fixed incorrect line numbers after mutiline comments and verbatim strings. * [#16](https://github.com/adangel/pmd/pull/16): Fixed several C++ lexical / tokenize errors. * [#17](https://github.com/adangel/pmd/pull/17): Fixed '--files' command line option of CPD, so it also works for files and not only for directories. +* [#18](https://github.com/adangel/pmd/pull/18): Created extra CSV output format `csv_with_linecount_per_file` which outputs the correct line count per file. **Bugfixes:** @@ -33,3 +35,11 @@ * [#1299](https://sourceforge.net/p/pmd/bugs/1299/): MethodReturnsInternalArray false positive * [#1306](https://sourceforge.net/p/pmd/bugs/1306/): False positive on duplicate when using static imports * [#1308](https://sourceforge.net/p/pmd/bugs/1308/): PMD runs endlessly on some generated files + +**API Changes:** + +* `net.sourceforge.pmd.cpd.Match.iterator()` now returns an iterator of the new type `net.sourceforge.pmd.cpd.Mark` instead + of TokenEntry. A `Mark` contains all the informations about each single duplication, including the TokenEntry via `Mark.getToken()`. + This Mark is useful for reporting the correct line count for each duplication. Previously only one line count was available. + As for some languages CPD can be instructed to ignore comments, the line count could be different in the different files + for the same duplication.