Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule: rule-assigns-default #1243

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Rule: rule-assigns-default #1243

merged 1 commit into from
Nov 6, 2024

Conversation

anderseknert
Copy link
Member

Flags rules where the default value is used as the assigned value in any other incremental definition.

Fixes #1018

(unrelated changes mostly adding some ignore directives in Go code is from me having update golangci-lint which led to a few new issues getting reported)


default allow := false

# or just `allow if {` as `true` is implicit
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if a non boolean example would be a good addition here too? E.g.

default cpu_shares := 0.1

cpu_shares := 0.5 if input.role == "developer"
cpu_shares := 0.1 if input.role == "intern"

Or something similar?

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, yes, good one... I'll amend in my next PR

Flags rules where the default value is used as the assigned value
in any other incremental definition.

Fixes #1018

(unrelated changes mostly adding some ignore directives in Go code
is from me having update golangci-lint which led to a few new issues
getting reported)

Signed-off-by: Anders Eknert <[email protected]>
@anderseknert anderseknert merged commit aba5ef4 into main Nov 6, 2024
5 checks passed
@anderseknert anderseknert deleted the rule-assigns-default branch November 6, 2024 14:46
charlieegan3 pushed a commit to charlieegan3/regal that referenced this pull request Jan 6, 2025
Flags rules where the default value is used as the assigned value
in any other incremental definition.

Fixes StyraInc#1018

(unrelated changes mostly adding some ignore directives in Go code
is from me having update golangci-lint which led to a few new issues
getting reported)

Signed-off-by: Anders Eknert <[email protected]>
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.

Rule: rule-assigns-default
2 participants