Skip to content

Commit cad03c2

Browse files
committed
Add the PMD Plugin
1 parent fc0ee15 commit cad03c2

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

buildSrc/src/main/groovy/com.craftsmanshipinsoftware.common-conventions.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'java'
3+
id 'pmd'
34
}
45

56
repositories {
@@ -19,3 +20,11 @@ testing {
1920
}
2021
}
2122
}
23+
24+
pmd {
25+
consoleOutput = true
26+
toolVersion = "7.6.0"
27+
ruleSets = ["category/java/errorprone.xml",
28+
"category/java/bestpractices.xml",
29+
"category/java/performance.xml"]
30+
}

characters-count/src/main/java/com/craftsmanshipinsoftware/charscnt/console/CharactersCounter.java

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public void displayCharactersCount() {
2727
this.printStream.printf("%s has %d characters.%n", input, input.length());
2828
}
2929

30+
@SuppressWarnings("PMD.SystemPrintln")
3031
private void askForInput() {
3132
System.out.print("What is the input string? ");
3233
}

printing-quotes/src/main/java/com/craftsmanshipinsoftware/prntqts/QuotesPrinter.java

+2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ void displayQuote() {
3333
}
3434
}
3535

36+
@SuppressWarnings("PMD.SystemPrintln")
3637
private void askForQuote() {
3738
System.out.print("What is the quote? ");
3839
}
3940

41+
@SuppressWarnings("PMD.SystemPrintln")
4042
private void askForAuthor() {
4143
System.out.print("Who said it? ");
4244
}

saying-hello/src/main/java/com/craftsmanshipinsoftware/hello/GreetPrinter.java

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void sayHello() {
2323
this.printStream.printf("Hello, %s, nice to meet you!%n", name);
2424
}
2525

26+
@SuppressWarnings("PMD.SystemPrintln")
2627
private void askForName() {
2728
System.out.print("What is your name? ");
2829
}

0 commit comments

Comments
 (0)