Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Infrastructure "Detect mapgen keys which are used but not defined, to help catch typos in maps"
Purpose of change
As demonstrated by #37845 and #37839, it is easy for mappers to accidentally put typos into their maps or forget to define particular keys they use in their maps. Having fixed those issues, we want to prevent similar issues from occurring in the future.
Describe the solution
When parsing the
are permitted to have no definition provided
rows
entry from json mapgen, verify that every character used has some definition, except that.
andfill_ter
is being used, or the entry defines nested mapgen.The error is fatal, but only occurs in
test_mode
.I also refactored some of the surrounding code for greater clarity, including renaming the (mysterious to me)
qualifies
variable.Describe alternatives you've considered
Some mods still contain many mapgen errors, so it doesn't seem feasible to make this a non-test-mode error yet, because it would be annoying for players using those mods (even if it were made non-fatal), but once those mods are fixed or removed from the main repo, that should be changed.
Testing
It was with this code that I found all the errors fixed in #37845 and #37839, so that tested it fairly well.
Additional context
This was originally inspired by me implementing a feature addition for Unicode mapgen keys. Once this is merged, I plan to PR that.