lloyAlloy on GitHub
and_or_ternary
Docs

and_or_ternary

Updated

c and a or b in place of a ternary.

Flux. The and ... or idiom yields b when a is false or nil, whatever c was; that is the classic Lua trap. c ? a : b picks by c alone. When a is a literal that is never false, the two are the same and alloy flux --fix rewrites it; otherwise the lint shows the ternary and leaves the change to the author.

Set its level in the [lint] table of alloy.toml, or for one file with --@alloy-lint.