Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
path: ~/.m2/repository
key: maven-cache-${{ hashFiles('**/pom.xml') }}

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 17
java-version: 21

- name: Build with Maven
run: mvn -e --no-transfer-progress install
10 changes: 4 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<checkstyle.version>10.4</checkstyle.version>
<checkstyle.version>13.3.0</checkstyle.version>
<maven.checkstyle.plugin.version>3.2.0</maven.checkstyle.plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<junit.version>5.9.1</junit.version>
</properties>

Expand Down Expand Up @@ -115,9 +115,7 @@
<includeResources>false</includeResources>
<includeTestResources>false</includeTestResources>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>
https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-${checkstyle.version}/config/checkstyle_checks.xml
</configLocation>
<configLocation>google_checks.xml</configLocation>
<propertiesLocation>config/checkstyle.properties</propertiesLocation>
<failOnViolation>true</failOnViolation>
<logViolationsToConsole>true</logViolationsToConsole>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public boolean accept(TreeWalkerAuditEvent event) {
* @return true if it is matching
*/
private boolean isFileNameMatching(TreeWalkerAuditEvent event) {
String eventFileName = event.getFileName();
String eventFileName = event.fileName();
boolean result = eventFileName != null;

if (result) {
Expand Down Expand Up @@ -225,7 +225,7 @@ private boolean isNeverSuppressCheck(TreeWalkerAuditEvent event) {
*/
private boolean isLineMatching(TreeWalkerAuditEvent event) {
boolean result = false;
if (event.getViolation() != null) {
if (event.violation() != null) {
result = lineMatching(event.getLine());
}
return result;
Expand Down Expand Up @@ -337,7 +337,7 @@ private static boolean containsShortName(Set<String> checkNameSet,
}

private static String getCheckName(TreeWalkerAuditEvent event) {
final String[] checkNames = event.getViolation().getSourceName().split("\\.");
final String[] checkNames = event.violation().getSourceName().split("\\.");
return checkNames[checkNames.length - 1];
}

Expand All @@ -352,7 +352,7 @@ private static String getCheckShortName(TreeWalkerAuditEvent event) {
* @return DetailAST event's corresponding ast node
*/
private static DetailAST getEventAst(TreeWalkerAuditEvent event) {
DetailAST curNode = event.getRootAst();
DetailAST curNode = event.rootAst();
DetailAST eventAst = null;
while (curNode != null) {
if (isMatchingAst(curNode, event)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected String getPatchFileLocation() {
}

@Override
protected String getPackageLocation() {
public String getPackageLocation() {
return "com/puppycrawl/tools/checkstyle/filters/suppressionjavapatchfilter/";
}

Expand All @@ -55,15 +55,12 @@ public void testShortName() throws Exception {
public void testNonExistentPatchFileWithFalseOptional() throws Exception {
try {
testByConfig("Optional/false/defaultContextConfig.xml");
}
catch (CheckstyleException ex) {
assertEquals("cannot initialize module TreeWalker - "
+ "cannot initialize module "
+ "com.puppycrawl.tools.checkstyle.filters.SuppressionJavaPatchFilter "
+ "- an error occurred when loading patch file "
+ getPatchFileLocation() + "Optional/false//defaultContext.patch",
ex.getMessage(),
"Invalid error message");
} catch (CheckstyleException ex) {
assertEquals(
"cannot initialize module TreeWalker - cannot initialize module "
+ "com.puppycrawl.tools.checkstyle.filters.SuppressionJavaPatchFilter",
ex.getMessage()
);
}
}

Expand All @@ -79,7 +76,7 @@ public void testNeverSuppressedChecks() throws Exception {
testByConfig("neversuppressedchecks/CovariantEquals/"
+ "checkID/newline/defaultContextConfig.xml");
testByConfig("neversuppressedchecks/CovariantEquals"
+ "/checkID/patchedline/defaultContextConfig.xml");
+ "/checkID/patchedline/defaultContextConfig.xml");
testByConfig("neversuppressedchecks/CovariantEquals/"
+ "checkShortName/context/defaultContextConfig.xml");
testByConfig("neversuppressedchecks/CovariantEquals/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected String getPatchFileLocation() {
}

@Override
protected String getPackageLocation() {
public String getPackageLocation() {
return "com/puppycrawl/tools/checkstyle/filters/suppressionpatchfilter/";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class GitDiffOnOpenSourceTest extends AbstractModuleTestSupport {

@Override
protected String getPackageLocation() {
public String getPackageLocation() {
return "com/puppycrawl/tools/checkstyle/filters/";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:0: Required pattern '// This code is copyrighted\n// \(c\) MyCompany' missing in file.
Test.java:1: Required pattern '// This code is copyrighted\n// \(c\) MyCompany' missing in file.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:7:5: All overloaded methods should be placed next to each other. Placing non-overloaded methods in between overloaded methods with the same type is a violation. Previous overloaded method located at line '5'.
Test.java:7:5: All overloaded methods should be placed next to each other. Previous overloaded method located at line '5'.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:15:5: All overloaded methods should be placed next to each other. Placing non-overloaded methods in between overloaded methods with the same type is a violation. Previous overloaded method located at line '13'.
Test.java:15:5: All overloaded methods should be placed next to each other. Previous overloaded method located at line '13'.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:15:5: All overloaded methods should be placed next to each other. Placing non-overloaded methods in between overloaded methods with the same type is a violation. Previous overloaded method located at line '13'.
Test.java:15:5: All overloaded methods should be placed next to each other. Previous overloaded method located at line '13'.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:7: <p> tag should be preceded with an empty line.
Test.java:7:4: <p> tag should be preceded with an empty line.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:8: <p> tag should be preceded with an empty line.
Test.java:8:4: <p> tag should be preceded with an empty line.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:8: <p> tag should be preceded with an empty line.
Test.java:8:4: <p> tag should be preceded with an empty line.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:4: Summary javadoc is missing.
Test.java:4:8: Summary javadoc is missing.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:9: Summary javadoc is missing.
Test.java:9:8: Summary javadoc is missing.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test.java:4: Summary javadoc is missing.
Test.java:4:8: Summary javadoc is missing.
Loading