Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

JSON report content #99

Closed
pauldijou opened this issue May 12, 2016 · 3 comments
Closed

JSON report content #99

pauldijou opened this issue May 12, 2016 · 3 comments

Comments

@pauldijou
Copy link

When reading the JSON from elm-make, for each warning / error, you have overview and details fields containing text info about the problem. Regarding the naming of the fields, I would expect the first one to be a "short" summary of the issue and the other one diving deeper on what exactly is the problem and how to eventually solve it. Sometime it's exactly that:

[{"tag":"missing type annotation",
"overview":"Top-level value `test` does not have a type annotation.",
"details":"I inferred the type annotation so you can copy it into your code:\n\ntest : number",
"region":{"start":{"line":6,"column":1},"end":{"line":6,"column":5}},
"type":"warning",
"file":"src/Test.elm"}]

If you only print overview, it's enough to understand the problem. But some other times, you are forced to use both of them or the message will not make any sense.

[{"tag":"SYNTAX PROBLEM",
"overview":"I need whitespace, but got stuck on what looks like a new declaration. You are\neither missing some stuff in the declaration above or just need to add some\nspaces here:",
"subregion":null,
"details":"I am looking for one of the following things:\n\n    whitespace",
"region":{"start":{"line":6,"column":1},"end":{"line":6,"column":1}},
"type":"error",
"file":"Main.elm"}]

As we can see, displaying only the overview will result in a truncated message missing the end. It's kind of a bummer if you are building a tool based on this report and only display the overview by default.

Also, I might be wrong, but it feels strange to have \n inside the JSON. It forces how to render the result while I consider JSON to be only about raw data. I would expect to have such newlines added when actually printing the message on the shell (or somewhere else).

@evancz
Copy link
Contributor

evancz commented Jun 6, 2016

Do you think this is covered by #98? If not, how would you summarize your request in a short sentence?

@pauldijou
Copy link
Author

Don't think so. In short: overview and details should be standalone rather than being forced to concatenate them to have the full message (otherwise, only one field would be enough) and not contain any styling, only the raw message (no \n and no ).

@evancz
Copy link
Contributor

evancz commented Aug 9, 2016

Added to #98 with a summary of what I think the solution might be.

@evancz evancz closed this as completed Aug 9, 2016
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