Fix rule tests
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user