1
我正在为SonarQube Javascript插件编写一个自定义规则插件。 现在我想按规则禁用特定目录中的检查。 (例如,不应该在bin路径中检查)如何在Sonarqube Javascript扩展中获取项目路径
现在我的问题:如何获取相对于项目路径检查的文件的路径。或者另一个解决方案是:如何获得项目路径?
我的代码是:
@Override
public void visitNode(Tree tree) {
CallExpressionTree callExpression = (CallExpressionTree) tree;
if (callExpression.callee().is(Kind.DOT_MEMBER_EXPRESSION)) {
DotMemberExpressionTree callee = (DotMemberExpressionTree) callExpression.callee();
// get the file that is checked
File toTestedFile = getContext().getFile();
//how to get the project path here to get the relative path???
if (isCalleeConsoleLogging(callee)) {
addLineIssue(tree, MESSAGE);
}
}
}