Allow users to specify fields that should be sorted
The list of build rule/macro fields that is sorted is currently hardcoded into buildifer. How hard would it be to make this list user-configurable, and is that something y'all think would make sense?
I ask because there are a lot of fields that buildifier can and should sort, but does not today:
- test_data, test_deps, test_srcs, test_tags: see #1097
- implementation_deps: see #1119 (and I also know another company that wants to sort this field)
- and other fields specific to organizations' build rules
Adding these fields to the hardcoded list in buildifier today (tables/tables.go) is tricky because every single time a change along these lines is proposed, an LSC needs to be applied to google3 before the change can actually get made to buildifier (plus the bidi copybara sync?).
Having an user-configurable list of additional fields to sort would allow buildifier users to sort fields that their organizations want to sort, without requiring buildifier maintainers to LSC google3 every time a new field is proposed.
Correct me if I'm wrong, but this is what the -tables and -add_tables arguments are for, right? Users can write their own customizations to a JSON file and then either override or merge their tables w/ the built-in list. See https://github.com/RobotLocomotion/drake/blob/master/tools/lint/buildifier-tables.json for an example.