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 diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000..4eb6fcb --- /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..831e294 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,35 @@ maven-war-plugin 3.3.1 + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + checkstyle.xml + false + true + true + warning + true + + + + com.puppycrawl.tools + checkstyle + 9.1 + + + + + validate + validate + + check + + + + diff --git a/src/main/java/com/tritoncubed/chatapp/PingServlet.java b/src/main/java/com/tritoncubed/chatapp/PingServlet.java index acea715..13f2895 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", @@ -36,10 +33,11 @@ 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()) + .add("response", "pong") + .add("timestamp", System.currentTimeMillis()) .build(); response.getWriter().append(json.toString()); }