Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netkan option to validate .ckan file #2819

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

HebaruSan
Copy link
Member

Motivation

KSP-CKAN/xKAN-meta_testing#51 (comment)

Also, in theory NetKAN can consume a CKAN and output a validated CKAN. Maybe md5 before/after and we can catch when a CKAN is handcrafted (which we never want to do).

This would help to unify our pull request validation logic, as the CKAN-meta script could use netkan.exe for validation just as the NetKAN script does.

Changes

Now a new command format is supported:

mono netkan.exe --validate-ckan Astrogator/Astrogator-v0.9.2.ckan

This will load the indicated .ckan file and run Netkan's standard validators on it (see #2788). If there are any problems, the usual error will be printed and the process will exit with a failure code.

If the .ckan file is valid, it will be printed with standard pretty formatting and property sorting, as if it had just been generated by netkan.exe, and the process will exit with a success code.

@HebaruSan HebaruSan added Enhancement New features or functionality Easy This is easy to fix Pull request Netkan Issues affecting the netkan data labels Jun 29, 2019
@techman83
Copy link
Member

This is awesome! We have the hashing functions already, maybe an --output-sha256 that we can compare (or maybe it can do it internally?). Not needed to merge this.

@techman83 techman83 merged commit 58f5d5a into KSP-CKAN:master Jul 1, 2019
@HebaruSan HebaruSan deleted the feature/netkan-validate-ckan branch July 1, 2019 02:23
@DasSkelett
Copy link
Member

DasSkelett commented Jul 1, 2019

If the .ckan file is valid, it will be printed with standard pretty formatting and property sorting, as if it had just been generated by netkan.exe, and the process will exit with a success code.

Could we have an option to overwrite the .ckan if it is valid, to replace it with the pretty formatting? E.g. a [-o] flag.

@techman83
Copy link
Member

Technically that's NetKANs job 😉 I think maybe I didn't think through the option and got caught up in the excitement 😅

Although there is hope, as part of the validate command checksum the input and output to see if they match, potentially giving a different exit code for each exception type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy This is easy to fix Enhancement New features or functionality Netkan Issues affecting the netkan data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants