groupe-sii / sonar-web-frontend-reporters

This is a repo of SII continuous integration build system dedicated to Front-end webapps.
22 stars 10 forks source link

HTMLHint JSON output can be invalid #7

Closed jh409 closed 8 years ago

jh409 commented 8 years ago

Hi,

I currently have an issue where the HTML reporter is producing invalid JSON when the offending HTML is on a new line.

For example, this HTML:

<button class="cancelButton" onclick="return false;">Cancel</button>

produces this invalid JSON in the report:

{ "line": 62, "message": "Inline script [ onclick = 'return false;'] cannot be use.", "description": "Inline script cannot be use.", "rulekey": "inline-script-disabled", "severity": "MINOR", "reporter": "htmlhint", "creationDate": 1472831618394 }

I'm also using your frontend plugin, which then throws an exception when it tries to parse this JSON.

I realise that this is due to the handling of the message in HTMLHint rule itself, but I don't think that's trying to create JSON, whereas the HTML reporter here is, hence why I'm reporting it here.

If you think it's an issue with the original HTMLHint, I will report it there instead.

cedric-legallo commented 8 years ago

Hi, this issues was fixed a fex time ago by this commit : https://github.com/groupe-sii/sonar-web-frontend-reporters/commit/2d57cead4be6d59cd0bdc2964215b44fb3cff6c1

but this version is not on npm at the moment. I'll fix that today

jh409 commented 8 years ago

Great, thanks!