Custom Rules - picking obj.functionCall(argumentsValue)
Hello FlexPMD Community,
I am trying to write some custom rules for picking:
private function downloadFile():void
{
fileRef.download("/abc/xyz");
}
The best, I could do is:
private
static final String METHOD_NAME[] = {"download"};
private static final String SECURITY[] = {"FileReference"};
@2226279
protected final void findViolations( final IClass classNode )
{
for(final IFunction function : classNode.getFunctions())
{
if(function.getBody().findPrimaryStatementsFromNameInChildren(SECURITY).size() > 0)
{
for(final IParserNode functionCall : function.getBody().findPrimaryStatementsFromNameInChildren(METHOD_NAME))
{
addViolation( functionCall );
}
}
}
}
I was hoping to be able to traverse AST with objRef.functionCall and than retrieve the value /abc/xyz.
Any help greatly appreciated.
- Mansi
