Fix rule tests

This commit is contained in:
Clément Fournier
2020-05-02 22:36:20 +02:00
parent 473ae2ef19
commit 3190c0365c
3 changed files with 8 additions and 3 deletions

View File

@@ -70,7 +70,8 @@ public abstract class BaseAntlrNode<A extends AntlrToPmdParseTreeAdapter<N>, N e
@Override
public N getParent() {
return (N) asAntlrNode().getParent().getPmdNode();
AntlrToPmdParseTreeAdapter<N> parent = asAntlrNode().getParent();
return parent == null ? null : (N) parent.getPmdNode();
}
@Override

View File

@@ -34,6 +34,10 @@ public abstract class BaseAntlrTerminalNode<N extends GenericNode<N>>
}
}
public String getText() {
return antlrNode.symbol.getText();
}
@Override
protected AntlrTerminalPmdAdapter<N> asAntlrNode() {
return antlrNode;

View File

@@ -26,9 +26,9 @@ Rules which enforce generally accepted best practices.
<property name="version" value="2.0" />
<property name="xpath">
<value>
//VariableDeclarationHead/Attributes/Attribute[AttributeName/Identifier[@Name = "IBOutlet"]]
//VariableDeclarationHead/Attributes/Attribute[AttributeName/Identifier/T-Identifier[@Text = "IBOutlet"]]
|
//FunctionHead/Attributes/Attribute[AttributeName/Identifier[@Name = "IBAction"]]
//FunctionHead/Attributes/Attribute[AttributeName/Identifier/T-Identifier[@Text = "IBAction"]]
</value>
</property>
</properties>