wesnoth / wesnoth

An open source, turn-based strategy game with a high fantasy theme.
https://www.wesnoth.org/
GNU General Public License v2.0
5.36k stars 995 forks source link

FR: User-friendly schema validation for UMC authors #4225

Open stevecotton opened 4 years ago

stevecotton commented 4 years ago

The --validate option has good behaviour - it runs headless, and gives confirmation if everything passed:

Validating data/_main.cfg against schema build_dir/data/schema/game_config.cfg
validation succeeded

Both the --validate-core and --validate-addon options are less user-friendly. Both of them start the GUI, and neither print anything if there are no errors.

stevecotton commented 3 years ago

Retitled as the existing tool isn't meant to be what I thought it was. This is now a feature-request for a new tool.

I'd like an error-checker for UMC authors,, equivalent to the mainline campaigns' utils/travis/schema_validation, which runs the non-interactive commands

wesnoth --validate data/_main.cfg --preprocess-defines=EASY,CAMPAIGN_THE_RISE_OF_WESNOTH,DISABLE_GRAND_MARSHAL
wesnoth --validate data/_main.cfg --preprocess-defines=NORMAL,CAMPAIGN_THE_RISE_OF_WESNOTH,DISABLE_GRAND_MARSHAL
etc

Ideally, the user would be able to just tell it the add-on's id and have the tool automatically read the [campaign]define= and [campaign]extra_defines=.

Posted by @CelticMinstrel in https://github.com/wesnoth/wesnoth/issues/4224#issuecomment-688519229 :

The --validate [should this be --validate-core?] and --validate-addon options are not scripting options. They validate WML as you play. So, if you use --validate-addon but don't play the target addon, then it won't find anything. Also I believe --preprocess-defines are not used for these two options.

I'd say the key point about this issue is still true, though - it should complain if you try to validate an addon that doesn't exist. It probably just needs a check somewhere in the command-line post-processing phase.