sonar-xsl / Sonar-XSL-Plugin

A Schematron-based SonarQube plugin for XSL code quality measurement.
http://www.sonarxsl.org/
Apache License 2.0
5 stars 3 forks source link

Error on Schematron sensor for xsl not well formed #20

Open benedictbasa opened 3 years ago

benedictbasa commented 3 years ago

Hi Jim,

Am encountering some issue with parsing not well formed xsl. Is there a way to actually put/push this type of analysis into the sonar that way it will be flagged as blocker or unsuccessful for scanning?

Log Error on line 453 column 2 of .xsl: SXXP0003: Error reported by XML parser: The content of elements must consist of well-formed character data or markup. ERROR: [SchematronSensor]An error occurend analysing file : file:///.xsl net.sf.saxon.s9api.SaxonApiException: org.xml.sax.SAXParseException; systemId: file:///*.xsl; lineNumber: 453; columnNumber: 2; The content of elements must consist of well-formed character data or markup.

thanks, Ben

jimetevenard commented 3 years ago

Hi @benedictbasa,

Yes it is possible to do that by rainsing an Issue on the whole file in that case. (i.e. without specifing any line number or text range for the Issue)

The Native SonarQube XML Plugin does it as well :

XML parser failure

Code Smell - Major - Main sources - suspicious - Available Since - May 21, 2020 - SonarAnalyzer (XML) - Constant/issue: 30min
Issue link on my Sonar instance

When the XML parser fails, it is possible to record the failure as a violation on the file. This way, not only it is possible to track the number of files that do not parse but also to easily find out why they do not parse.

Regards,
Jim.

jimetevenard commented 3 years ago

👍 Just putted this on the TO-DO list for the upcoming release.