问题
After upgrading sonar from 3.4 to 4.3.2 version, we are getting java script parsing error during jenkins nightly build. It was all working fine in last version.The sonar runner is still of version 2. COuld you please advice on resolving this error. The plugin used is sonar-javascript-plugin-1.6, sonar-squid-java-plugin-1.6.
Error details:
[INFO] [12:56:47.163] Sensor JavaScriptSquidSensor...
[INFO] [12:56:47.275] 98 source files to be analyzed
[INFO] [12:56:57.330] 10/98 files analyzed, current is /var/lib/jenkins/jobs/Nightly_Build_abc_CAD_src/workspace/abc_CAD_src/src/main/webapp/auth/js/lib/angular/jquery-ui-1.9.0.custom.js
[ERROR] [12:57:01.429] Unable to parse file: /var/lib/jenkins/jobs/Nightly_Build_abc_CAD_src/workspace/abc_CAD_src/src/main/webapp/js/lib/csrfguard.js
com.sonar.sslr.api.RecognitionException: Parse error at line 199 column 13 failed to match all of: spacing IDENTIFIER NULL TRUE FALSE NUMERIC_LITERAL stringLiteral REGULAR_EXPRESSION_LITERAL LBRACKET LCURLYBRACE LPARENTHESIS FUNCTION NEW THIS IDENTIFIER NULL TRUE FALSE NUMERIC_LITERAL stringLiteral REGULAR_EXPRESSION_LITERAL LBRACKET LCURLYBRACE LPARENTHESIS FUNCTION NEW NEW THIS IDENTIFIER NULL TRUE FALSE NUMERIC_LITERAL stringLiteral REGULAR_EXPRESSION_LITERAL LBRACKET LCURLYBRACE LPARENTHESIS FUNCTION NEW THIS IDENTIFIER NULL TRUE FALSE NUMERIC_LITERAL stringLiteral REGULAR_EXPRESSION_LITERAL LBRACKET LCURLYBRACE LPARENTHESIS FUNCTION NEW NEW DELETE VOID TYPEOF INC DEC PLUS MINUS TILDA BANG
回答1:
As clarified in the comments on the OP, your parsing errors are a result of some previously-excluded files no longer being excluded from the analysis. Those files are now included because your exclusions are specified at analysis time (i.e. in pom.xml or sonar-project.properties), and that is no longer supported. I believe that happened in 3.5
To eliminate the parsing errors, you'll need to re-specify your exclusions into the interface. The docs should help.
来源:https://stackoverflow.com/questions/25260674/java-script-parsing-error-during-jenkins-nightly-build-after-upgrading-sonar-to