Format canonical data using jq#1916
Conversation
SaschaMann
left a comment
There was a problem hiding this comment.
Exploding arrays onto several lines seems undesirable in most cases.
| "property": "accumulate", | ||
| "input": { | ||
| "list": [1, 2, 3], | ||
| "list": [ |
There was a problem hiding this comment.
These don't seem desirable. They make reading and copy and pasting cases harder when manually implementing a solution.
| [ | ||
| "a1", | ||
| "a2", | ||
| "a3" | ||
| ], | ||
| [ | ||
| "b1", | ||
| "b2", | ||
| "b3" | ||
| ], | ||
| [ | ||
| "c1", | ||
| "c2", | ||
| "c3" | ||
| ] |
There was a problem hiding this comment.
This is way harder to read than the matrix on the left.
| "digits": [ | ||
| 1, | ||
| 0, | ||
| 1, | ||
| 0, | ||
| 1, | ||
| 0 | ||
| ], | ||
| "outputBase": 10 |
There was a problem hiding this comment.
This doesn't read like a binary number anymore.
| "The error object is used to indicate that the value is not included in the array.", | ||
| "It should be replaced with the respective expression that is idiomatic", | ||
| "for the language that implements the tests.", | ||
|
|
There was a problem hiding this comment.
Should probably be replaced with a "", or ignored then because the newline seems intentional.
| "dominoes": [ | ||
| [ | ||
| 1, | ||
| 2 | ||
| ], | ||
| [ | ||
| 3, | ||
| 1 | ||
| ], | ||
| [ | ||
| 2, | ||
| 3 | ||
| ] | ||
| ] |
There was a problem hiding this comment.
An even worse example than the ones above 😅
|
Totally agree on the array examples. Are all arrays rewrites bad, or just some? |
|
I've only skimmed and commented on a few. I think for the inputs/outputs, they might not all be that bad but manual formatting depending on the context would be better. As for reformatting the comment arrays, that seems pointless but also not harmful. |
| "square": 64 | ||
| }, | ||
| "expected": 9223372036854775808 | ||
| "expected": 9223372036854776000 |
There was a problem hiding this comment.
unfortunate. for this reason, we may not be able to use jq to format grains.
| "property": "total", | ||
| "input": {}, | ||
| "expected": 18446744073709551615 | ||
| "expected": 18446744073709552000 |
There was a problem hiding this comment.
unfortunate. for this reason, we may not be able to use jq to format grains.
|
I've also opened #1917 to see what the formatting looks like when using prettier. The prettier changes look more sensible to me. |
|
Closing this in favor of #1917 |
While looking into re-ordering the keys across all
canonical-data.jsonfiles, I found that there was a lot of inconsistency in the formatting between files.This isn't a big problem, but some consistency is nice.
For this draft PR, I've used jq to reformat all the canonical data files, as its style of formatting seemed to be slightly closer to our current style than prettier.
The goal of this file is to check which formatting changes are desirable, and more important: which are not.