prefix-dev / rattler-build

rattler-build is a universal package builder for Windows, macOS and Linux
https://prefix-dev.github.io/rattler-build
BSD 3-Clause "New" or "Revised" License
220 stars 50 forks source link

Disallow `-` in context variable names #995

Open wolfv opened 4 months ago

wolfv commented 4 months ago

Since - is also the minus operator which will probably not work in jinja, we should forbid it in the left-hand side in the context, e.g.

context:
  foo-bar: baz

should trigger a parsing error.

Heidar-An commented 3 months ago

Hey, I'd love to tackle this! Is this the correct place that I should be changing - https://github.com/prefix-dev/rattler-build/blob/main/src/recipe/parser.rs#L184-L193

Would adding something along the lines of "if k.contains("-") ... ERR" be correct?

Sorry for ping: @wolfv?