From f3550c86bf58d09ff84d74da6fac1b093345b4fd Mon Sep 17 00:00:00 2001 From: Christopher Madrigal Date: Tue, 16 Nov 2021 13:28:42 -0800 Subject: [PATCH 1/5] add checkstyle plugin and style sheet --- checkstyle.xml | 364 +++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 34 +++++ 2 files changed, 398 insertions(+) create mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000..0a8f890 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index d47cdf6..ea7adb8 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,40 @@ maven-war-plugin 3.3.1 + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + google_checks.xml + false + + + + + check + + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + + checkstyle + + + + + + From 994bc283e330e7242e000399f078f42b4a0feccd Mon Sep 17 00:00:00 2001 From: Christopher Madrigal Date: Tue, 16 Nov 2021 14:33:13 -0800 Subject: [PATCH 2/5] update checkstyle dependency and build rules --- checkstyle.xml | 8 ++--- pom.xml | 33 ++++++++----------- .../com/tritoncubed/chatapp/PingServlet.java | 9 ++--- 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index 0a8f890..4eb6fcb 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -246,12 +246,12 @@ value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> - - - + + + - + diff --git a/pom.xml b/pom.xml index ea7adb8..2a4b91e 100644 --- a/pom.xml +++ b/pom.xml @@ -66,14 +66,24 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 - + 3.1.2 - google_checks.xml + checkstyle.xml false + true + true + + + com.puppycrawl.tools + checkstyle + 9.1 + + + checkstyle + verify check @@ -82,21 +92,4 @@ - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.2 - - - - checkstyle - - - - - - diff --git a/src/main/java/com/tritoncubed/chatapp/PingServlet.java b/src/main/java/com/tritoncubed/chatapp/PingServlet.java index acea715..64a232a 100644 --- a/src/main/java/com/tritoncubed/chatapp/PingServlet.java +++ b/src/main/java/com/tritoncubed/chatapp/PingServlet.java @@ -1,5 +1,6 @@ package com.tritoncubed.chatapp; +import java.io.IOException; import javax.json.Json; import javax.json.JsonObject; import javax.servlet.ServletException; @@ -8,12 +9,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - /** * A servlet that performs a small ping for the user. A simple GET request is made, and a simple * acknowledgement is sent back. - * * http://launchapi.tritoncubed.com/ping */ @WebServlet("/ping") @@ -28,7 +26,6 @@ public PingServlet() { /** * This method contains the logic of the ping request. The request itself is contained in its * namesake object, and the response is created in its namesake object. - * * The response is a JSON object with the following layout: * { * "response": "pong", @@ -38,8 +35,8 @@ public PingServlet() { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { JsonObject json = Json.createObjectBuilder() - .add("response", "pong") - .add("timestamp", System.currentTimeMillis()) + .add("response", "pong") + .add("timestamp", System.currentTimeMillis()) .build(); response.getWriter().append(json.toString()); } From 690e13e20cb57fe0f1a72f55e023bd30c096883e Mon Sep 17 00:00:00 2001 From: Christopher Madrigal Date: Tue, 16 Nov 2021 14:36:15 -0800 Subject: [PATCH 3/5] fix validation fail condition --- pom.xml | 2 ++ src/main/java/com/tritoncubed/chatapp/PingServlet.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2a4b91e..19880c8 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,9 @@ checkstyle.xml false + true true + warning true diff --git a/src/main/java/com/tritoncubed/chatapp/PingServlet.java b/src/main/java/com/tritoncubed/chatapp/PingServlet.java index 64a232a..13f2895 100644 --- a/src/main/java/com/tritoncubed/chatapp/PingServlet.java +++ b/src/main/java/com/tritoncubed/chatapp/PingServlet.java @@ -33,7 +33,8 @@ public PingServlet() { * } */ @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { JsonObject json = Json.createObjectBuilder() .add("response", "pong") .add("timestamp", System.currentTimeMillis()) From f2241e3dc248e2c2efefd697b3b306e173893d7e Mon Sep 17 00:00:00 2001 From: Christopher Madrigal Date: Tue, 16 Nov 2021 14:39:12 -0800 Subject: [PATCH 4/5] fix action --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ef3f978..53198df 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,4 +21,4 @@ jobs: distribution: 'adopt' cache: maven - name: Build with Maven - run: mvn -B package --file pom.xml + run: mvn -B verify --file pom.xml From f6cd586a533b6339a1a947839f8686e104e4289f Mon Sep 17 00:00:00 2001 From: Christopher Madrigal Date: Sun, 27 Feb 2022 20:01:33 -0800 Subject: [PATCH 5/5] small edits --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 19880c8..831e294 100644 --- a/pom.xml +++ b/pom.xml @@ -84,8 +84,8 @@ - checkstyle - verify + validate + validate check