Skip to content

Should we have any sort of automatic verification of canonical-data.json content? #460

Closed
@petertseng

Description

@petertseng

#105 has gotten us off to a good start to make sure that our JSON files are syntactically correct, but does nothing to check the contents.

I have historically concerned myself (maybe to an unreasonable degree, even) about this second aspect:

Since it has now been asked in #456, now is the time to ask what y'all think: Should we have such a thing in our CI?

The current implementation in my verify branch is as follows:

  • Each exercise directory may optionally have a verify.rb file.
  • The idea is that Travis could run this file if it is present.
  • Some verify.rb are more detailed than others (e.g. minesweeper only checks that the inputs are indeed the cleaned version of the outputs but doesn't check that the output is a correct annotation, pov actually has a full solution to the exercise to make sure the input/output pairs are correct)

  • Pro: Automatic verification helps avoid incorrect data, and after all we are but human.
  • Con: We necessarily have to pick some language in which to write the verification scripts, and perhaps such a choice unnecessarily biases this repo toward that language.
    • But at least it's better than nothing, right?
    • And I suppose we could support multiple languages...
  • Con: Does this mean we have to reimplement an example solution for each exercise and maintain it in this repo?
    • What's the alternative? Pull in an existing example solution from a language track that has the exercise? Then Travis CI starts to depend on not just this repo but the presence of some other repo as well.

I am happy to clean up my verify branch and submit it as a PR if we decide the pros outweigh the cons, with discussion to find any pros and cons I missed.


Aside: As an argument for standardisation (as proposed by #336), if all the JSON had a standardised structure you could imagine that we could remove some of the logic that has to be implemented separately in each verify.rb script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions