Applying global config to Buildifier

892 views
Skip to first unread message

Mark Holmes

unread,
Sep 15, 2020, 1:20:54 PM9/15/20
to bazel-discuss

Currently, Buildifier will automatically sort arguments/lists in BUILD files alphabetically. This isn't great behaviour for me as the code I'm working on (unfortunately!) depends on arguments to be passed through in a particular order.

As per https://github.com/bazelbuild/buildtools/issues/125 this can be worked around using # do not sort, which is fine, but is there a way to specify this behaviour automatically for all instances of my_rule(). That is, any time I call my_rule(), Buildifier will know not to sort its args?

Thanks,
Mark

Daniel Wagner-Hall

unread,
Sep 15, 2020, 6:27:21 PM9/15/20
to Mark Holmes, bazel-discuss
This is configurable via https://github.com/bazelbuild/buildtools/blob/master/tables/tables.go 

The -tables and -add_tables flags allow you to override or merge this config using a JSON file.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/08cf5c0d-41e9-4738-be29-7c64bdfae33fn%40googlegroups.com.

Daniel Wagner-Hall

unread,
Sep 28, 2020, 11:40:35 AM9/28/20
to Mark Holmes, bazel-discuss
I don't believe so, but it wouldn't be a tricky thing to add, and I suspect no one would object :)

On Sun, 27 Sep 2020 at 21:26, Mark Holmes <m.r.h...@live.com> wrote:
Hi Daniel,

Thanks for the reply, this is exactly what I was after! Does Buildifier support any form of .rc file such that I could automatically add those flags implicitly whenever I call the tool?

Many thanks,
Mark

From: Daniel Wagner-Hall <dawa...@gmail.com>
Sent: 15 September 2020 23:27
To: Mark Holmes <m.r.h...@live.com>
Cc: bazel-discuss <bazel-...@googlegroups.com>
Subject: Re: Applying global config to Buildifier
 
Reply all
Reply to author
Forward
0 new messages