Introducing KDE Activity Filter

Adriaan de Groot groot at kde.org
Sun Jul 19 09:20:56 BST 2020


On Tuesday, 14 July 2020 10:57:41 CEST Ingo Klöcker wrote:
> On Dienstag, 14. Juli 2020 10:20:33 CEST Kåre Särs wrote:
> > Is there a way to verify that the yaml file is syntactically correct
> > before
> > pushing the change?
> 
> There are loads of YAML linters/validators, online and offline. In fact,
> this would be an opportunity to test-drive the awesome GitLab CI/CD. I
> volunteer to implement this, if sysadmin is okay with this.

There's a bunch of different tools for YAML validation indeed. "kwalify" was 
one, I think. With a name like that .. :) Unfortunately, lots of the tools are 
also unmaintained, as I found out when I went looking recently.

JSON-schema claims, though, to be maintained and applies to YAML and beyond 
(for those sensible cases where your YAML is a representation of JSON, and not 
the edge cases of what YAML can do).

For Calamares, which is chock-full of simple YAML files, I ended up bodging a 
tool together in Python where most of the code ends up being validation logic, 
followed by one call to the Python library `jsonschema`. There's probably 
other ready-to-go tools like it.

https://github.com/calamares/calamares/blob/calamares/ci/configvalidator.py

A typical schema file for JSON-schema can be represented in YAML as well 
(because YAML is JSON, or something). Here's one, which has some enums, 
handles a list, and also contains string and boolean settings:

https://github.com/calamares/calamares/blob/calamares/src/modules/welcome/
welcome.schema.yaml

> Or do you mean "semantically correct", i.e. also checking for valid
> projects?

(From a JSON-schema perspective) You might periodically generate a schema type 
that checks the repository-re, for the simple case of |-separated full 
repository names. Personally I'd be more inclined to follow Albert's original 
question, and change the tool not to eat a RE but a YAML list-of-repo-names.

[ade]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20200719/243afb67/attachment.sig>


More information about the kde-core-devel mailing list