Skip to content

Conversation

@anderseknert
Copy link
Member

I noticed in some rule I worked on that Regal didn't flag this, which was right given that interpolated strings aren't exactly scalar values. But I do want to have Regal recommend moving them to the head assignment when possible, while keeping the only-scalars option set as true. This PR adds a new include-interpolated option to allow this precisely, and makes it enabled in our own settings.

# to the head, and not expressions or functions
only-scalars: false
# when set to true, counts interpolated strings as a scalar value, and will suggest
# moving them to the head even when `only-scalars` is true
Copy link
Contributor

@charlieegan3 charlieegan3 Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# moving them to the head even when `only-scalars` is true
# moving them to the head even when `only-scalars` is true

@charlieegan3 charlieegan3 force-pushed the prefer-interpolated-in-head branch from c8f2534 to a3964ee Compare January 12, 2026 16:00
@anderseknert anderseknert force-pushed the prefer-interpolated-in-head branch from a3964ee to a64c40d Compare January 12, 2026 21:17
I noticed in some rule I worked on that Regal didn't flag this, which was
right given that interpolated strings aren't exactly scalar values. But
I _do_ want to have Regal recommend moving them to the head assignment when
possible, while keeping the `only-scalars` option set as `true`. This PR
adds a new `include-interpolated` option to allow this precisely, and makes
it enabled in our own settings.

Signed-off-by: Anders Eknert <[email protected]>
@anderseknert anderseknert force-pushed the prefer-interpolated-in-head branch from a64c40d to cc99522 Compare January 12, 2026 21:49
@anderseknert anderseknert merged commit 54cdcb6 into open-policy-agent:main Jan 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants