Re: [BuildStream] Proposal: bst fmt command



On Tue, 13 Nov 2018 at 13:11, Thomas Coldrick via BuildStream-list
<buildstream-list gnome org> wrote:

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

+1

* Running `bst fmt --all` formats all elements in the project

+1

* 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

+1, maybe we could use "bst validate/verify" for this instead, but I'm
ok with the --check options as well
I guess this would support bst fmt --all --check ?

* 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

Indeed, this would be a great 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.

Thanks a lot to work on this; it would indeed very helpful to have a
uniform format in our builstream projects

Cheers,
Javier


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