Hi,
I'm trying to use your js custom rule example from
https://github.com/SonarSource/sonar-custom-rules-examples/tree/master/javascript-custom-rules
But after I build the plugin + deploy to the server, the sonarqube
reporting url does not seem
to be pickin up the custom rule. (I tested this by running the
sonar-scanner on the src/ dir
in the javascript-custom-rules/ sample).
Here are the details of what I did (on linux):
First, I did this getting started setup:
https://docs.sonarqube.org/display/SONAR/Get+Started+in+Two+Minutes
(this worked perfectly!)
Next, I try to use your javascript-custom-rules example.
Followed this procedure
https://docs.sonarqube.org/display/PLUG/Custom+Rules+for+SonarJS
Copied the javascript-custom-rules
https://github.com/SonarSource/sonar-custom-rules-examples/tree/master/javascript-custom-rules
built it successfully with % mvn clean package,
then copied the javascript-custom-rules-1.0-SNAPSHORT.jar into
sonarqube's extensions/plugins directory.
Looking at the server's web.log seems to deploy properly:
web.log:2017.05.18 15:03:44 INFO
web[][o.s.s.p.ServerPluginRepository] Deploy plugin JavaScript Custom
Rules / 1.0-SNAPSHOT
So it seems like the server is now using this new js custom rule.
So next I want to test this custom rule by running sonar-scanner on some
.js code.
So I create a sonar-project.properties in
sonar-custom-rules-examples-master/javascript-custom-rules/
sonar-project.properties is very simple:
sonar.projectKey=custom-rules:sample
sonar.projectName=Custom Rules
sonar.projectVersion=1.0
sonar.sources=src
sonar.sourceEncoding=UTF-8
Then I run sonar-scanner, then view the results on localhost:9000
However, I don't see any difference in the results whenI use the custom
JS plugin or when I don't use it.
(I'll get 3 errors on forbiddenFunctionUseCheck.js, these seem to be all
from built-in rules)
src/test/resources/checks/forbiddenFunctionUseCheck.js
"foo" does not exist. Change its name or declare it so that its
usage doesn't result in a "ReferenceError".
"bar" does not exist. Change its name or declare it so that its
usage doesn't result in a "ReferenceError".
Replace Obj with a constructor function.
Am I missing a step ?
thanks,
-Lory
Lory Molesky
Oracle