I am currently developing a custom rules plugin for the SonarQube Javascript Plugin. I have encountered an issue where I need to disable certain checks in specific directories, such as the bin path.
My main question is: how can I obtain the file path relative to the project path that is being checked? Alternatively, is there a way to retrieve the project path itself?
This is a snippet of my code:
@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 being checked
File toTestedFile = getContext().getFile();
//how can I fetch the project path to determine the relative path?
if (isCalleeConsoleLogging(callee)) {
addLineIssue(tree, MESSAGE);
}
}
}