Skip to content

Commit 537649b

Browse files
Pmd clean up (JSQLParser#1215)
* Add PMD Annotations in order to avoid useless exceptions for the Deparsers * Add Eclipse Formatter configuration * Fix typo * Replace Comments on empty methods with Class wide PMD Annotation Do not enforce checkstyle formatting
1 parent c783240 commit 537649b

37 files changed

+505
-99
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Also I would like to know about needed examples or documentation stuff.
6363
** API change FunctionWithCondParams production removed
6464
* API change in ValuesStatement: the expression list is now hold as a ItemList and not as a List<Expression>
6565
* support for parser modification within **parseExpression** and **parseCondExpression**
66-
' support for table schema for foreign keys
66+
* support for table schema for foreign keys
6767
* support for Oracle hints on **insert, update and merge**
6868
* support for **merge insert where** clause
6969
* allow **in** as schema name

eclipse-java-google-style.xml

+337
Large diffs are not rendered by default.

nb-configuration.xml

+8
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,13 @@
2020
<com-junichi11-netbeans-changelf.use-global>false</com-junichi11-netbeans-changelf.use-global>
2121
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
2222
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
23+
<org-netbeans-modules-editor-indent.text.xml.CodeStyle.project.expand-tabs>false</org-netbeans-modules-editor-indent.text.xml.CodeStyle.project.expand-tabs>
24+
<org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>none</org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap>
25+
<org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>4</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>
26+
<org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>4</org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab>
27+
<org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>4</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
28+
<org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>120</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
29+
<org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>
30+
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
2331
</properties>
2432
</project-shared-configuration>

pmd-rules.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,7 @@ under the License.
110110

111111
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
112112
<rule ref="category/java/performance.xml/BooleanInstantiation" />
113-
113+
114+
<!-- for Codazy -->
115+
<rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody" />
114116
</ruleset>

pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@
365365
<artifactId>javacc-maven-plugin</artifactId>
366366
<version>2.6</version>
367367
</plugin>
368+
<plugin>
369+
<groupId>org.apache.maven.plugins</groupId>
370+
<artifactId>maven-checkstyle-plugin</artifactId>
371+
<configuration>
372+
<configLocation>config/sun_checks.xml</configLocation>
373+
</configuration>
374+
</plugin>
368375
</plugins>
369376
</reporting>
370377

src/main/java/net/sf/jsqlparser/expression/AnalyticExpression.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void setIgnoreNulls(boolean ignoreNulls) {
179179
}
180180

181181
@Override
182-
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength"})
182+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
183183
public String toString() {
184184
StringBuilder b = new StringBuilder();
185185

src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import net.sf.jsqlparser.statement.select.UnPivot;
3131
import net.sf.jsqlparser.statement.select.WithItem;
3232

33-
@SuppressWarnings({"PMD.CyclomaticComplexity"})
33+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.UncommentedEmptyMethodBody"})
3434
public class ExpressionVisitorAdapter implements ExpressionVisitor, ItemsListVisitor, PivotVisitor, SelectItemVisitor {
3535

3636
private SelectVisitor selectVisitor;

src/main/java/net/sf/jsqlparser/expression/Function.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void setKeep(KeepExpression keep) {
168168
}
169169

170170
@Override
171-
@SuppressWarnings({"PMD.CyclomaticComplexity"})
171+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
172172
public String toString() {
173173
String params;
174174

src/main/java/net/sf/jsqlparser/expression/operators/relational/ItemsListVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import net.sf.jsqlparser.statement.select.SubSelect;
1313

14+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1415
public class ItemsListVisitorAdapter implements ItemsListVisitor {
1516

1617
@Override

src/main/java/net/sf/jsqlparser/statement/StatementVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import net.sf.jsqlparser.statement.upsert.Upsert;
3434
import net.sf.jsqlparser.statement.values.ValuesStatement;
3535

36+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
3637
public class StatementVisitorAdapter implements StatementVisitor {
3738

3839
@Override

src/main/java/net/sf/jsqlparser/statement/alter/AlterExpression.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public void setUk(boolean uk) {
360360
}
361361

362362
@Override
363-
@SuppressWarnings({"PMD.CyclomaticComplexity"})
363+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
364364
public String toString() {
365365

366366
StringBuilder b = new StringBuilder();

src/main/java/net/sf/jsqlparser/statement/create/table/CreateTable.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void setRowMovement(RowMovement rowMovement) {
141141
}
142142

143143
@Override
144-
@SuppressWarnings({"PMD.CyclomaticComplexity"})
144+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
145145
public String toString() {
146146
String sql;
147147
String createOps = PlainSelect.getStringList(createOptionsStrings, false, false);

src/main/java/net/sf/jsqlparser/statement/insert/Insert.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void setWithItemsList(List<WithItem> withItemsList) {
207207
}
208208

209209
@Override
210-
@SuppressWarnings({"PMD.CyclomaticComplexity"})
210+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
211211
public String toString() {
212212
StringBuilder sql = new StringBuilder();
213213
if (withItemsList != null && !withItemsList.isEmpty()) {

src/main/java/net/sf/jsqlparser/statement/select/FromItemVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import net.sf.jsqlparser.schema.Table;
1313

14+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1415
public class FromItemVisitorAdapter implements FromItemVisitor {
1516

1617
@Override

src/main/java/net/sf/jsqlparser/statement/select/GroupByElement.java

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public void addGroupingSet(ExpressionList list) {
5555
}
5656

5757
@Override
58+
@SuppressWarnings({"PMD.CyclomaticComplexity"})
5859
public String toString() {
5960
StringBuilder b = new StringBuilder();
6061
b.append("GROUP BY ");

src/main/java/net/sf/jsqlparser/statement/select/IntoTableVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import net.sf.jsqlparser.schema.Table;
1313

14+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1415
public class IntoTableVisitorAdapter implements IntoTableVisitor {
1516

1617
@Override

src/main/java/net/sf/jsqlparser/statement/select/Join.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ public boolean isWindowJoin() {
263263

264264
/**
265265
* Return the "WITHIN" join window (if any)
266+
* @return
266267
*/
267268
public KSQLJoinWindow getJoinWindow() {
268269
return joinWindow;
@@ -278,7 +279,7 @@ public void setJoinWindow(KSQLJoinWindow joinWindow) {
278279
}
279280

280281
@Override
281-
@SuppressWarnings({"PMD.CyclomaticComplexity"})
282+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
282283
public String toString() {
283284
if (isSimple() && isOuter()) {
284285
return "OUTER " + rightItem;

src/main/java/net/sf/jsqlparser/statement/select/OrderByVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package net.sf.jsqlparser.statement.select;
1111

12+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1213
public class OrderByVisitorAdapter implements OrderByVisitor {
1314

1415
@Override

src/main/java/net/sf/jsqlparser/statement/select/PivotVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package net.sf.jsqlparser.statement.select;
1111

12+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1213
public class PivotVisitorAdapter implements PivotVisitor {
1314

1415
@Override

src/main/java/net/sf/jsqlparser/statement/select/PlainSelect.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public void setKsqlWindow(KSQLWindow ksqlWindow) {
322322
}
323323

324324
@Override
325-
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength"})
325+
@SuppressWarnings({"PMD.CyclomaticComplexity" , "PMD.ExcessiveMethodLength", "PMD.NPathComplexity"})
326326
public String toString() {
327327
StringBuilder sql = new StringBuilder();
328328
if (useBrackets) {

src/main/java/net/sf/jsqlparser/statement/select/Select.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void setSelectBody(SelectBody body) {
4242
}
4343

4444
@Override
45+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
4546
public String toString() {
4647
StringBuilder retval = new StringBuilder();
4748
if (withItemsList != null && !withItemsList.isEmpty()) {

src/main/java/net/sf/jsqlparser/statement/select/SelectItemVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package net.sf.jsqlparser.statement.select;
1111

12+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1213
public class SelectItemVisitorAdapter implements SelectItemVisitor {
1314

1415
@Override

src/main/java/net/sf/jsqlparser/statement/select/SelectVisitorAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import net.sf.jsqlparser.statement.values.ValuesStatement;
1313

14+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1415
public class SelectVisitorAdapter implements SelectVisitor {
1516

1617
@Override

src/main/java/net/sf/jsqlparser/statement/select/TableFunction.java

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import net.sf.jsqlparser.expression.Alias;
1313
import net.sf.jsqlparser.expression.Function;
1414

15+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
1516
public class TableFunction extends FunctionItem implements FromItem {
1617

1718
@Override

src/main/java/net/sf/jsqlparser/statement/select/ValuesList.java

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
2020
import net.sf.jsqlparser.expression.operators.relational.MultiExpressionList;
2121

22+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
2223
public class ValuesList implements FromItem {
2324

2425
private Alias alias;

src/main/java/net/sf/jsqlparser/statement/select/WithItem.java

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public void setWithItemList(List<SelectItem> withItemList) {
6060
}
6161

6262
@Override
63+
@SuppressWarnings({"PMD.CyclomaticComplexity"})
6364
public String toString() {
6465
return (recursive ? "RECURSIVE " : "") + name + ((withItemList != null) ? " " + PlainSelect.
6566
getStringList(withItemList, true, true) : "")

src/main/java/net/sf/jsqlparser/util/ConnectExpressionsVisitor.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*
2222
* @author tw
2323
*/
24+
@SuppressWarnings({"PMD.UncommentedEmptyMethodBody"})
2425
public abstract class ConnectExpressionsVisitor implements SelectVisitor, SelectItemVisitor {
2526

2627
private String alias = "expr";

0 commit comments

Comments
 (0)