Skip to content

Commit

Permalink
chore: Use pmd 7.1.0 for checks (#195)
Browse files Browse the repository at this point in the history
* chore: Use pmd 7.1.0 for checks

* [doc] Update release notes (#195)
  • Loading branch information
adangel authored Apr 26, 2024
1 parent ec7f6fe commit 2c64716
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
1 change: 1 addition & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This is a minor release.

### Merged pull requests
* [#194](https://github.com/pmd/pmd-eclipse-plugin/pull/194): \[ci] Support macos on arm64/aarch64
* [#195](https://github.com/pmd/pmd-eclipse-plugin/pull/195): chore: Use pmd 7.1.0 for checks

### API Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

package net.sourceforge.pmd.eclipse.ui.views.ast;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
Expand Down Expand Up @@ -47,7 +45,6 @@
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.ast.impl.AbstractNode;
import net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.rule.xpath.XPathVersion;
import net.sourceforge.pmd.reporting.RuleViolation;
Expand All @@ -72,13 +69,6 @@ public class ASTViewPage extends AbstractStructureInspectorPage {

// private static Set<String> keywords = new HashSet<String>();

private static Set<Class<?>> hiddenNodeTypes;

static {
hiddenNodeTypes = new HashSet<>();
hiddenNodeTypes.add(ASTImportDeclaration.class);
}

public ASTViewPage(IWorkbenchPart part, FileRecord record) {
super(part, record);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,62 @@
*/
public class NodeImageDeriver {

private static NodeImageDeriver compilationUnitDeriver = new NodeImageDeriver(ASTCompilationUnit.class) {
private static final NodeImageDeriver COMPILATION_UNIT_DERIVER = new NodeImageDeriver(ASTCompilationUnit.class) {
@Override
public String deriveFrom(Node node) {
dumpComments((ASTCompilationUnit) node);
return "Comments: " + ((ASTCompilationUnit) node).getComments().size();
}
};

private static NodeImageDeriver importDeriver = new NodeImageDeriver(ASTImportDeclaration.class) {
private static final NodeImageDeriver IMPORT_DERIVER = new NodeImageDeriver(ASTImportDeclaration.class) {
@Override
public String deriveFrom(Node node) {
// TODO show package name as well?
return ((ASTImportDeclaration) node).getImportedName();
}
};

private static NodeImageDeriver methodDeclarationDeriver = new NodeImageDeriver(ASTMethodDeclaration.class) {
private static final NodeImageDeriver METHOD_DECLARATION_DERIVER = new NodeImageDeriver(ASTMethodDeclaration.class) {
@Override
public String deriveFrom(Node node) {
return ASTUtil.getMethodLabel((ASTMethodDeclaration) node, true);
}
};

private static NodeImageDeriver throwStatementDeriver = new NodeImageDeriver(ASTThrowStatement.class) {
private static final NodeImageDeriver THROW_STATEMENT_DERIVER = new NodeImageDeriver(ASTThrowStatement.class) {
@Override
public String deriveFrom(Node node) {
final ASTClassType t = node.descendants(ASTClassType.class).first();
return t == null ? null : t.getSimpleName();
}
};

private static NodeImageDeriver fieldDeclarationDeriver = new NodeImageDeriver(ASTFieldDeclaration.class) {
private static final NodeImageDeriver FIELD_DECLARATION_DERIVER = new NodeImageDeriver(ASTFieldDeclaration.class) {
@Override
public String deriveFrom(Node node) {
return ASTUtil.getFieldLabel((ASTFieldDeclaration) node);
}
};

private static NodeImageDeriver localVariableDeclarationDeriver = new NodeImageDeriver(
private static final NodeImageDeriver LOCAL_VARIABLE_DECLARATION_DERIVER = new NodeImageDeriver(
ASTLocalVariableDeclaration.class) {
@Override
public String deriveFrom(Node node) {
return ASTUtil.getLocalVarDeclarationLabel((ASTLocalVariableDeclaration) node);
}
};

private static NodeImageDeriver annotationDeriver = new NodeImageDeriver(ASTAnnotation.class) {
private static final NodeImageDeriver ANNOTATION_DERIVER = new NodeImageDeriver(ASTAnnotation.class) {
@Override
public String deriveFrom(Node node) {
return ASTUtil.getAnnotationLabel((ASTAnnotation) node);
}
};

private static final NodeImageDeriver[] ALL_DERIVERS = new NodeImageDeriver[] { importDeriver,
methodDeclarationDeriver, localVariableDeclarationDeriver, fieldDeclarationDeriver, annotationDeriver,
compilationUnitDeriver, throwStatementDeriver };
private static final NodeImageDeriver[] ALL_DERIVERS = new NodeImageDeriver[] { IMPORT_DERIVER,
METHOD_DECLARATION_DERIVER, LOCAL_VARIABLE_DECLARATION_DERIVER, FIELD_DECLARATION_DERIVER, ANNOTATION_DERIVER,
COMPILATION_UNIT_DERIVER, THROW_STATEMENT_DERIVER };

private static final Map<Class<?>, NodeImageDeriver> DERIVERS_BY_TYPE = new HashMap<>(
NodeImageDeriver.ALL_DERIVERS.length);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<checkstyle.version>10.14.0</checkstyle.version>
<checkstyle.plugin.version>3.3.1</checkstyle.plugin.version>
<pmd.plugin.version>3.22.0</pmd.plugin.version>
<pmd.check.version>7.0.0</pmd.check.version>
<pmd.check.version>7.1.0</pmd.check.version>

<keystorePath>.ci/files/pmd-eclipse-plugin.p12</keystorePath>
<keystore>${basedir}/${keystorePath}</keystore>
Expand Down

0 comments on commit 2c64716

Please sign in to comment.