Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

HTML outputted in the report #4

Closed
dingo-d opened this issue Jan 21, 2017 · 1 comment
Closed

HTML outputted in the report #4

dingo-d opened this issue Jan 21, 2017 · 1 comment

Comments

@dingo-d
Copy link
Member

dingo-d commented Jan 21, 2017

I found an error when showing the report while sniffing. I am not sure how are you bundling the sniffer in the plugin (manually?) I didn't look that much in the code, but it seems to me that the full report file is missing (on line 182 in \Reports\Full.php)

echo htmlspecialchars($errorMsg, ENT_QUOTES, 'UTF-8', false).PHP_EOL;

I tried to make a PR to the phpcs, but the author explained that this is a human readable format and that it should remain that way, and that the better course of action would be to use

JSON, XML or CSV report types and then display the output however you want.

The reason for this issue is that the report, as it currently is, will render the HTML elements in the report. For instance (on the left is the plugin, on the right the report I manually made with phpcs):

issue_1

When corrected would be

issue_1_corrected

I tried adding htmlspecialchars in the helpers.php of the plugin but that didn't work. You could change the report to JSON, then parse it and show it I guess, don't know how much time that would take. Or, if you are manually placing codesniffer in you can modify the file I did, even though this will only create issues if you need to update the code sniffer periodically.

@dingo-d dingo-d closed this as completed Feb 2, 2017
@grappler
Copy link
Member

grappler commented Feb 2, 2017

Related issues #1 & WordPress/WordPress-Coding-Standards#749

grappler referenced this issue in grappler/ns-theme-check Feb 18, 2017
fixes #4
@grappler grappler mentioned this issue Feb 18, 2017
@dingo-d dingo-d mentioned this issue Feb 26, 2019
17 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants