Skip to content

Commit 2162f3c

Browse files
build: PMD compliance
1 parent f01bf42 commit 2162f3c

6 files changed

Lines changed: 20 additions & 95 deletions

File tree

build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,12 @@ spotbugs {
180180

181181
pmd {
182182
consoleOutput = false
183-
toolVersion = "6.46.0"
184-
185183
sourceSets = [sourceSets.main]
186184

187185
// clear the ruleset in order to use configured rules only
188186
ruleSets = []
189187

190188
//rulesMinimumPriority = 1
191-
192189
ruleSetFiles = files("config/pmd/ruleset.xml")
193190

194191
pmdMain {

config/pmd/ruleset.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ under the License.
4848
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
4949
<rule ref="category/java/codestyle.xml/UselessParentheses" />
5050
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
51-
52-
<!-- for Codazy -->
51+
52+
<!-- for Codazy -->
5353
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
5454
<properties>
5555
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*" />

pom.xml

Lines changed: 3 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
<plugin>
132132
<groupId>org.apache.maven.plugins</groupId>
133133
<artifactId>maven-pmd-plugin</artifactId>
134-
<version>3.14.0</version>
134+
<version>3.19.0</version>
135135
<configuration>
136136
<rulesets>
137137
<!-- Custom local file system rule set -->
@@ -218,7 +218,7 @@
218218
<dependency>
219219
<groupId>net.java.dev.javacc</groupId>
220220
<artifactId>javacc</artifactId>
221-
<version>7.0.11</version>
221+
<version>7.0.12</version>
222222
</dependency>
223223
</dependencies>
224224
</plugin>
@@ -418,92 +418,11 @@
418418
<version>3.3.0</version>
419419
</plugin>
420420

421-
<!-- Cobertura is broken with Java 1.8 and there is not fix
422-
please refer to https://github.com/cobertura/cobertura/issues/248
423-
424-
<plugin>
425-
<groupId>org.codehaus.mojo</groupId>
426-
<artifactId>cobertura-maven-plugin</artifactId>
427-
<version>2.7</version>
428-
<configuration>
429-
<aggregate>true</aggregate>
430-
<outputDirectory>${project.reporting.outputDirectory}/cobertura</outputDirectory>
431-
</configuration>
432-
</plugin>
433-
-->
434-
435421
<plugin>
436422
<groupId>org.codehaus.mojo</groupId>
437423
<artifactId>findbugs-maven-plugin</artifactId>
438424
<version>3.0.5</version>
439425
</plugin>
440-
441-
<!-- Obsolete or Unused
442-
<plugin>
443-
<groupId>org.apache.maven.plugins</groupId>
444-
<artifactId>maven-checkstyle-plugin</artifactId>
445-
<configuration>
446-
<configLocation>config/sun_checks.xml</configLocation>
447-
</configuration>
448-
</plugin>
449-
-->
450-
451-
<!-- JJDoc report generating the BNF documentation -->
452-
<plugin>
453-
<groupId>org.javacc.plugin</groupId>
454-
<artifactId>javacc-maven-plugin</artifactId>
455-
<version>3.0.3</version>
456-
<configuration>
457-
<!--
458-
/**
459-
* A flag to specify the output format for the generated documentation. If set to <code>true</code>, JJDoc will
460-
* generate a plain text description of the BNF. Some formatting is done via tab characters, but the intention is to
461-
* leave it as plain as possible. Specifying <code>false</code> causes JJDoc to generate a hyperlinked HTML document
462-
* unless the parameter {@link #bnf} has been set to <code>true</code>. Default value is <code>false</code>.
463-
*
464-
* @parameter expression="${text}"
465-
*/
466-
-->
467-
<text>false</text>
468-
469-
<!--
470-
/**
471-
* A flag whether to generate a plain text document with the unformatted BNF. Note that setting this option to
472-
* <code>true</code> is only effective if the parameter {@link #text} is <code>false</code>. Default value is
473-
* <code>false</code>.
474-
*
475-
* @parameter expression="${bnf}"
476-
* @since 2.6
477-
*/
478-
-->
479-
<bnf>false</bnf>
480-
481-
<!--
482-
/**
483-
* This option controls the structure of the generated HTML output. If set to <code>true</code>, a single HTML
484-
* table for the entire BNF is generated. Setting it to <code>false</code> will produce one table for every
485-
* production in the grammar.
486-
*
487-
* @parameter expression="${oneTable}" default-value=true
488-
*/
489-
-->
490-
<oneTable>false</oneTable>
491-
492-
<!--
493-
/**
494-
* The hypertext reference to an optional CSS file for the generated HTML documents. If specified, this CSS file
495-
* will be included via a <code>&lt;link&gt;</code> element in the HTML documents. Otherwise, the default style will
496-
* be used.
497-
*
498-
* @parameter expression="${cssHref}"
499-
* @since 2.5
500-
*/
501-
-->
502-
<!-- <cssHref></cssHref> -->
503-
504-
<outputDirectory>${project.reporting.outputDirectory}</outputDirectory>
505-
</configuration>
506-
</plugin>
507426
</plugins>
508427
</reporting>
509428

@@ -628,7 +547,7 @@
628547

629548
<properties>
630549
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
631-
<pmdVersion>6.46.0</pmdVersion>
550+
<pmdVersion>6.53.0</pmdVersion>
632551
</properties>
633552

634553
<description>JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes.

src/main/java/net/sf/jsqlparser/statement/upsert/Upsert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ public String toString() {
159159
StringBuilder sb = new StringBuilder();
160160

161161
switch (upsertType) {
162-
case UPSERT:
163-
sb.append("UPSERT ");
164-
break;
165162
case REPLACE:
166163
case REPLACE_SET:
167164
sb.append("REPLACE ");
@@ -181,6 +178,9 @@ public String toString() {
181178
case INSERT_OR_ROLLBACK:
182179
sb.append("INSERT OR ROLLBACK ");
183180
break;
181+
case UPSERT:
182+
default:
183+
sb.append("UPSERT ");
184184
}
185185

186186
if (isUsingInto) {

src/main/java/net/sf/jsqlparser/statement/upsert/UpsertType.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*-
2+
* #%L
3+
* JSQLParser library
4+
* %%
5+
* Copyright (C) 2004 - 2023 JSQLParser
6+
* %%
7+
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
8+
* #L%
9+
*/
110
package net.sf.jsqlparser.statement.upsert;
211

312
public enum UpsertType {

src/main/java/net/sf/jsqlparser/util/deparser/UpsertDeParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public UpsertDeParser(ExpressionVisitor expressionVisitor, SelectVisitor selectV
4141
@SuppressWarnings("PMD.CyclomaticComplexity")
4242
public void deParse(Upsert upsert) {
4343
switch (upsert.getUpsertType()) {
44-
case UPSERT:
45-
buffer.append("UPSERT ");
46-
break;
4744
case REPLACE:
4845
case REPLACE_SET:
4946
buffer.append("REPLACE ");
@@ -63,6 +60,9 @@ public void deParse(Upsert upsert) {
6360
case INSERT_OR_ROLLBACK:
6461
buffer.append("INSERT OR ROLLBACK ");
6562
break;
63+
case UPSERT:
64+
default:
65+
buffer.append("UPSERT ");
6666
}
6767

6868
if (upsert.isUsingInto()) {

0 commit comments

Comments
 (0)