rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

Use consistent template variable names

Open nacl opened this issue 4 years ago • 3 comments

rules_pkg uses multiple template variables throughout the codebase, including:

  • %VAR%
  • {VAR}
  • ${VAR}

Pick one (not necessarily from these), and make all uses consistent where possible. It may not be in some locations (like in the pkg_rpm script.

Originally posted by @aiuto in https://github.com/bazelbuild/rules_pkg/pull/380#discussion_r670118887

nacl avatar Jul 19 '21 13:07 nacl

Considerations for evaluating a choice:

  • are we trying to match the style of a language?
    • just because Starlark looks like Python, does that mean python syntax is right?
    • just because Bazel is written in Java, and the Bazel developers sometimes use Java style, does that mean that is right?
    • probably neither matters because the users are coming from other build tools and probably use neither language on a daily basis.
  • are we trying to match the style of a well known build tool?
    • this seems reasonable if we consider that people are often migrating from something to Bazel
    • autotools style? (%{foo})
    • Make variables. ($(foo))
    • CMake (${FOO})? Maven?
    • bash style (and which one, $FOO or ${FOO}?)
    • Windows .bat style (%FOO%). Why not? There are more windows programmers than *ix people sometimes give credit for.

aiuto avatar Jul 21 '21 20:07 aiuto

My current vote is that python style will be the least surprising, because Starlark looks so much like Python, that carrying over idiomatic coding styles is more likely to be a win than matching another build tool style. Thus my vote is to unify around {var}.

aiuto avatar Nov 07 '21 04:11 aiuto

Resolved. We will use {var}

aiuto avatar Dec 06 '21 15:12 aiuto