简体   繁体   中英

SonarQube unable to parse inline JavaScript with JSP files

I am trying to analyze my JavaScript code using SonarQube. It analyzes both JavaScript and JSP files however it does not analyze inline JavaScript within a JSP file.

When in the configuration I try to evaluate a JSP file as a JavaScript file it ignores the file by giving the following issue.

09:53:50.491 ERROR - Unable to parse file: /home/user/.jenkins/jobs/Sev2Repro/workspace/common/faultyfix.jsp 09:53:50.491 ERROR - Parse error at line 1 column 1:

1: <c:if test="${not empty myBlock.viewAdapter and not empty myBlock.myAdapter.myImage}">
^
2:     <div style="display:none">
3:         <img src="${myBlock.myAdapter.myImage}" onerror="setmReq('af');setMReq('cf');">
4:     </div>
5: </c:if>

When I try to parse it as a Web file, it just ignores JavaScripts inside the jsp.

As far as I know, there's no SonarQube plugin which analyses JavaScript code contained inside HTML or JSP files. The JavaScript plugin only parses pure JavaScript files and raises parsing issue on any other file. The Web plugin does not have any rule about JavaScript code inside HTML/JSP files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM