forked from phoedos/pmd
Style issues
This commit is contained in:
@ -27,8 +27,9 @@ class MatchCollector {
|
|||||||
|
|
||||||
public void collect(List<TokenEntry> marks) {
|
public void collect(List<TokenEntry> marks) {
|
||||||
// first get a pairwise collection of all maximal matches
|
// first get a pairwise collection of all maximal matches
|
||||||
for (int i = 0; i < marks.size() - 1; i++) {
|
int skipped;
|
||||||
int skipped = 0;
|
for (int i = 0; i < marks.size() - 1; i += skipped + 1) {
|
||||||
|
skipped = 0;
|
||||||
TokenEntry mark1 = marks.get(i);
|
TokenEntry mark1 = marks.get(i);
|
||||||
for (int j = i + 1; j < marks.size(); j++) {
|
for (int j = i + 1; j < marks.size(); j++) {
|
||||||
TokenEntry mark2 = marks.get(j);
|
TokenEntry mark2 = marks.get(j);
|
||||||
@ -55,8 +56,6 @@ class MatchCollector {
|
|||||||
}
|
}
|
||||||
reportMatch(mark1, mark2, dupes);
|
reportMatch(mark1, mark2, dupes);
|
||||||
}
|
}
|
||||||
|
|
||||||
i += skipped;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,15 +37,15 @@ class MatchAlgorithmTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getMultipleRepetitionsCode() {
|
private static String getMultipleRepetitionsCode() {
|
||||||
return "var x = [\n" +
|
return "var x = [\n"
|
||||||
" 1, 1, 1, 1, 1, 1, 1, 1,\n" +
|
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n"
|
||||||
" 0, 0, 0, 0, 0, 0, 0, 0,\n" +
|
+ " 0, 0, 0, 0, 0, 0, 0, 0,\n"
|
||||||
" 2, 2, 2, 2, 2, 2, 2, 2,\n" +
|
+ " 2, 2, 2, 2, 2, 2, 2, 2,\n"
|
||||||
" 0, 0, 0, 0, 0, 0, 0, 0,\n" +
|
+ " 0, 0, 0, 0, 0, 0, 0, 0,\n"
|
||||||
" 3, 3, 3, 3, 3, 3, 3, 3,\n" +
|
+ " 3, 3, 3, 3, 3, 3, 3, 3,\n"
|
||||||
" 0, 0, 0, 0, 0, 0, 0, 0,\n" +
|
+ " 0, 0, 0, 0, 0, 0, 0, 0,\n"
|
||||||
" 4, 4, 4, 4, 4, 4, 4, 4\n" +
|
+ " 4, 4, 4, 4, 4, 4, 4, 4\n"
|
||||||
"];";
|
+ "];";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
package net.sourceforge.pmd.lang.cpp.cpd;
|
package net.sourceforge.pmd.lang.cpp.cpd;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -11,7 +14,6 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
import net.sourceforge.pmd.cpd.CPDConfiguration;
|
import net.sourceforge.pmd.cpd.CPDConfiguration;
|
||||||
import net.sourceforge.pmd.cpd.CpdAnalysis;
|
import net.sourceforge.pmd.cpd.CpdAnalysis;
|
||||||
import net.sourceforge.pmd.cpd.Match;
|
|
||||||
import net.sourceforge.pmd.internal.util.IOUtil;
|
import net.sourceforge.pmd.internal.util.IOUtil;
|
||||||
import net.sourceforge.pmd.lang.cpp.CppLanguageModule;
|
import net.sourceforge.pmd.lang.cpp.CppLanguageModule;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user