From b967f1323014b4b26c415a2a65f1aeba7a3a79e3 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 29 May 2021 21:54:19 -0700 Subject: [PATCH] Updated PMD rules. --- build.gradle | 35 +-- config/pmd.xml | 286 ++++-------------- docs/README.html | 10 +- .../thauvin/erik/httpstatus/UtilsTest.java | 4 +- 4 files changed, 90 insertions(+), 245 deletions(-) diff --git a/build.gradle b/build.gradle index 3c0b588..9ebf6da 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ mainClassName = 'net.thauvin.erik.httpstatus.Reasons' ext { versions = [ + pmd: '6.35.0', spotbugs: '4.2.3' ] } @@ -92,8 +93,8 @@ clean { test { testLogging { - exceptionFormat "full" - events "passed", "skipped", "failed" + exceptionFormat = "full" + events("passed", "skipped", "failed") } useTestNG() @@ -105,6 +106,7 @@ spotbugs { } pmd { + toolVersion = versions.pmd ignoreFailures = true ruleSets = [] ruleSetFiles = files("${projectDir}/config/pmd.xml") @@ -121,9 +123,9 @@ tasks.withType(Checkstyle) { publishing { publications { mavenJava(MavenPublication) { - from components.java - groupId project.group - artifactId rootProject.name + from(components.java) + groupId = project.group + artifactId = rootProject.name pom { name = mavenName @@ -171,19 +173,18 @@ signing { task copyToDeploy(type: Copy) { from(configurations.runtimeClasspath) { - exclude 'javax.servlet-api-*.jar' - exclude 'jsp-api-*.jar' + exclude('javax.servlet-api-*.jar', 'jsp-api-*.jar') } - from jar - into deployDir + from(jar) + into(deployDir) } task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) { description = "Copies all needed files to the ${deployDir} directory." group = 'Publishing' - outputs.dir deployDir - inputs.files copyToDeploy - mustRunAfter clean + outputs.dir(deployDir) + inputs.files(copyToDeploy) + mustRunAfter(clean) } task release(dependsOn: ['wrapper', 'deploy', 'pandoc', 'publishToMavenLocal']) { @@ -203,8 +204,8 @@ task pandoc(type: Exec) { if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine(['cmd', '/c', 'pandoc'] + pandoc_args) } else { - executable 'pandoc' - args pandoc_args + executable = 'pandoc' + args(pandoc_args) } standardOutput = new ByteArrayOutputStream() ext.output = { @@ -220,9 +221,9 @@ jacocoTestReport { sonarqube { properties { - property "sonar.organization", "ethauvin-github" - property "sonar.projectKey", "ethauvin_HttpStatus" - property "sonar.host.url", "https://sonarcloud.io" + property("sonar.organization", "ethauvin-github") + property("sonar.projectKey", "ethauvin_HttpStatus") + property("sonar.host.url", "https://sonarcloud.io") property("sonar.sourceEncoding", "UTF-8") } } diff --git a/config/pmd.xml b/config/pmd.xml index 2ce525b..890a490 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -1,120 +1,82 @@ - - Erik's Ruleset - - - - - - - - - + + + + + + + value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + @@ -122,86 +84,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -209,59 +96,16 @@ - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + diff --git a/docs/README.html b/docs/README.html index b04e36c..c024860 100644 --- a/docs/README.html +++ b/docs/README.html @@ -80,7 +80,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

HttpStatus JSP Tag Library

Release Maven Central
License (3-Clause BSD) Known Vulnerabilities Quality Gate Status
-Build Status Build status CircleCI

+GitHub CI Build status CircleCI

A simple JSP Tag Library to display the code, reason, cause and/or message for HTTP status codes in JSP error pages.

For example:

<%@ page isErrorPage="true" %>
@@ -547,22 +547,22 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
 

Usage with Gradle or Maven

Include the following in your build.gradle file:

dependencies {
-    implementation 'net.thauvin.erik.httpstatus:httpstatus:1.0.5'
+    implementation 'net.thauvin.erik.httpstatus:httpstatus:1.0.6'
 }
 

or as a Maven artifact:

Command Line Usage

You can query the reason phrase for status codes as follows:

-
$ java -jar httpstatus-1.0.5.jar 404 500
+
 

If no status code is specified, all will be printed:

-
$ java -jar httpstatus-1.0.5.jar
+
$ java -jar httpstatus-1.0.6.jar
 100: Continue
 101: Switching Protocols
 102: Processing
diff --git a/src/test/java/net/thauvin/erik/httpstatus/UtilsTest.java b/src/test/java/net/thauvin/erik/httpstatus/UtilsTest.java
index 9b9b660..e03ec34 100644
--- a/src/test/java/net/thauvin/erik/httpstatus/UtilsTest.java
+++ b/src/test/java/net/thauvin/erik/httpstatus/UtilsTest.java
@@ -61,7 +61,7 @@ public class UtilsTest {
     @SuppressFBWarnings("CE_CLASS_ENVY")
     @Test
     public void testOutWrite() throws IOException {
-        try (final StringWriter sw = new StringWriter()) {
+        try (StringWriter sw = new StringWriter()) {
             Utils.outWrite(sw, null, "default", false);
             assertEquals(sw.toString(), "default", "outWrite(default)");
 
@@ -98,4 +98,4 @@ public class UtilsTest {
             assertEquals(sw.toString(), "", "outWrite(null, xml)");
         }
     }
-}
\ No newline at end of file
+}