AsherGlick / ResourceCalculator

A Video Game Resource Calculator
https://resourcecalculator.com
GNU General Public License v3.0
59 stars 34 forks source link

Replacing the internal YAML datum with a typed datastructure #33

Closed AsherGlick closed 3 years ago

AsherGlick commented 3 years ago

This change begins to bring type hints to the resource calculator build script. It succeeds in adding types to nearly everything, with only a few exceptions around data that is about to be turned into JSON code.

All of the typed datastructure parsing from yaml is done via generated code which is reused for nested types. Due to this bespoke parsing there are some cases where the location of an error in the yeaml file can be provided.

A future change may allow this error location to be propagated to any yaml linter error we check for but that is out of scope of what this PR attempts to accomplish.

In addition to typing, the beginnings of a series of unit tests have been added. Hopefully more get added over time but these were primarily put in place to confirm that the new linter code was able to catch some of the same errors.

A regression as a result of this PR is that key ordering in yaml files is no longer linted and build.py will accept incorrectly ordered yaml fields without complaint.