sonarjs

how to get arguments for sonar 5.6.4 in SonarJS


My sonar version is 5.6.4 which throws java.lang.NoSuchMethodError at my code.

org.sonar.plugins.javascript.api.tree.expression.CallExpressionTree.argumentClause()Lorg/sonar/plugins/javascript/api/tree/expression/ArgumentListTree;

public void visitCallExpression(CallExpressionTree tree) {
    if (tree.callee() instanceof DotMemberExpressionTree){
      DotMemberExpressionTree dmTree = (DotMemberExpressionTree) tree.callee();
      System.out.println(tree);
      if (isLionGetProperty(dmTree) && tree.argumentClause().arguments().size() < 2) {
        addIssue(tree.callee(), MESSAGE);
      }
      super.visitCallExpression(tree);
    }
  }

My local plugin works fine which is based on Sonar 6.2. Where can I get some doc regarding an old version of SonarJS


Solution

  • Method argumentClause was added in SonarJS 3.0, you need to have at least this version of SonarJS installed to be able to use it. There is no documentation, you can find information in the source repository or JIRA (e.g. argumentClause was added in this ticket)