[BuildStream] Proposal: bst fmt command



Hi all,

There's been an issue[0] open for a while to implement a `bst fmt` command to format elements into a canonical format, opened after it was found `bst track` modifies yaml indentation[1]. As the yaml modification is due to ruamel, it would be nice to use the behaviour of this bug as a feature.

I propose implementing the following functionalities:
* Running `bst fmt <element>`formats just the element passed to the command
* Running `bst fmt --all` formats all elements in the project
* Running `bst fmt --check <element>` doesn't modify any files, but fails if not formatted correctly, and produces a diff of where formatting must be done * Users can define the order of top-level nodes in an element, running `bst fmt` on an element rearranges the nodes into this order - This may vary between projects, but a canonical format for each project would be a useful feature
* We could also include a `--except` option, as in `bst track`

This is only a minor feature, but will mitigate the pain of ruamel's changing of indentation.

Best Regards,
    Tom Coldrick

[0]: https://gitlab.com/BuildStream/buildstream/issues/485
[1]: https://gitlab.com/BuildStream/buildstream/issues/470


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]