Skip to content

Commit 72ac8b4

Browse files
committed
Fix/ignore critical smells reported by SonarCloud
1 parent f3d2b60 commit 72ac8b4

File tree

7 files changed

+11
-0
lines changed

7 files changed

+11
-0
lines changed

src/main/java/eu/happycoders/sort/CountOperations.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private void countOps(SortAlgorithm algorithm) {
3838
countOps(algorithm, true, "descending", ArrayUtils::createReversedArray);
3939
}
4040

41+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
4142
private void countOps(
4243
SortAlgorithm algorithm,
4344
boolean sorted,

src/main/java/eu/happycoders/sort/FindMinimumTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ private int countAssignmentsForSize(int size) {
4646
return assignments;
4747
}
4848

49+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
4950
private void printResults(int iterations) {
5051
System.out.printf(Locale.US, "Results after %d iterations:%n", iterations);
5152
for (int i = 0; i < NUM_SIZES; i++) {

src/main/java/eu/happycoders/sort/UltimateTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*
2929
* @author <a href="[email protected]">Sven Woltmann</a>
3030
*/
31+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
3132
public class UltimateTest {
3233

3334
static final SortAlgorithm[] ALGORITHMS =
@@ -138,6 +139,8 @@ private void test(
138139
}
139140
}
140141

142+
// In production code, we should never try to be smarter than the JVM; here we do try ;-)
143+
@SuppressWarnings({"PMD.DoNotCallGarbageCollectionExplicitly", "java:S1215"})
141144
private long measureTime(SortAlgorithm algorithm, int[] elements) {
142145
System.gc();
143146
long time = System.nanoTime();

src/main/java/eu/happycoders/sort/comparisons/DirectComparison.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*
1313
* @author <a href="[email protected]">Sven Woltmann</a>
1414
*/
15+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
1516
public class DirectComparison {
1617

1718
private static final int WARM_UPS = 15;
@@ -69,6 +70,8 @@ private static int[] getShuffledIndices(int numTestSets) {
6970
return indices;
7071
}
7172

73+
// In production code, we should never try to be smarter than the JVM; here we do try ;-)
74+
@SuppressWarnings({"PMD.DoNotCallGarbageCollectionExplicitly", "java:S1215"})
7275
private long measure(SortAlgorithm sortAlgorithm, int[] elements) {
7376
System.gc();
7477

src/main/java/eu/happycoders/sort/pivot/PivotComparator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ private void run() {
4545
runTest(algorithms);
4646
}
4747

48+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
4849
private void runTest(PartitioningAlgorithm[] algorithms) {
4950
longestNameLength = Scorecard.findLongestAlgorithmName(algorithms);
5051

src/main/java/eu/happycoders/sort/pivot/PivotScorecard.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void add(double largerPartPercentage) {
5252
*
5353
* @param longestNameLength the length to which the name is padded
5454
*/
55+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
5556
public void printResult(int longestNameLength) {
5657
System.out.printf(
5758
Locale.US,

src/main/java/eu/happycoders/sort/utils/Scorecard.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public boolean add(long time) {
4646
* @param longestNameLength the length to which the name is padded
4747
* @param label the optional label
4848
*/
49+
@SuppressWarnings({"PMD.SystemPrintln", "java:S106"})
4950
public void printResult(int longestNameLength, String label) {
5051
System.out.printf(
5152
Locale.US,

0 commit comments

Comments
 (0)