SonarJS custom rule


(vicky) #1

Hi Team,
How to raise the issues on a file if some keyword is not in the file . For ex: there are 10 js files and i need to check certain keywords like systemLocale.getLanguage() and if it is not available in the file i need to raise the issue.For this i can use .contains(“systemLocale.getLanguage()”) and check if it is not then raise the issue but by this way it will raise on all the files but i want to raise on only one perticular file.Is there any way to do this.Please Help!

(Elena Vilchik) #2


What is criteria for the file you want to consider in the rule? You can access file uri and name with this.getContext().getJavaScriptFile().