danielstjules / jsinspect

Detect copy-pasted and structurally similar code
MIT License
3.56k stars 128 forks source link

GNU message format #11

Closed paazmaya closed 9 years ago

paazmaya commented 9 years ago

Came across it at https://github.com/anandthakker/doiuse/issues/1

Seems rather trivial in comparison to the current default format, to add support for this format style. Format specified https://www.gnu.org/prep/standards/html_node/Errors.html

danielstjules commented 9 years ago

Thanks for the suggestion! What kind of tools are you planing on using for consuming this type of report? I'm assuming you wouldn't be reading it directly, as it doesn't seem very friendly:

When an error is spread over several files, you can use this format:

file1:line1.column1-file2:line2.column2: message

That means a single match, with 4 instances, would end up looking like:

spec/fixtures/intersection.js:1:5-spec/fixtures/intersection.js:7:11-spec/fixtures/intersection.js:1:5-spec/fixtures/indentation.js:7:11

And that's without showing a diff, which I don't think would fit this format very well. Anything that consumes it would break if the diff'ed source contained a line that looked like the above output. It would have to be escaped to accommodate the format, and given that the standard doesn't mention it, I think I'd be abusing it. What are your thoughts?

paazmaya commented 9 years ago

Perhaps for this format the diff would not be even shown, as whatever tool would then be used the parse the given error string, it could highlight it separately from the file.

This is an effort to unify the possible output formats by the tools I am using via Jenkins, so that I could possibly use same report parser.

danielstjules commented 9 years ago

In that case, couldn't you use the PMD reporter? https://github.com/danielstjules/jsinspect/issues/8

danielstjules commented 9 years ago

ping @paazmaya :) While the PMD reporter wouldn't be useful for unifying the output from all your tools, it would provide you something that's already usable with Jenkins

paazmaya commented 9 years ago

Hi, thanks for the pointer. It would be doable with PMD.