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
format: only use ref heads for all rule heads if necessary #5450
format: only use ref heads for all rule heads if necessary #5450
Conversation
Before, we'd end up formatting ps["foo"] = "bar" { true } as ps.foo = "bar" { true } and older OPA version know how to parse the former, but not the latter. Fixes open-policy-agent#5449. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing how formatting options are passed
format/format.go
Outdated
} | ||
|
||
func (w *writer) writeHead(head *ast.Head, isDefault, isExpandedConst, useContainsKW, useIf bool, comments []*ast.Comment) []*ast.Comment { | ||
func (w *writer) writeHead(head *ast.Head, isDefault, isExpandedConst, useContainsKW, useIf, useRefHead bool, comments []*ast.Comment) []*ast.Comment { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is getting out of hand
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The before/after tests really makes for some easy reviews 😊
…cy-agent#5450) Before, we'd end up formatting ps["foo"] = "bar" { true } as ps.foo = "bar" { true } and older OPA version know how to parse the former, but not the latter. Fixes open-policy-agent#5449. Also includes: * format: pass internal options via struct; because adding a third (in some cases fifth) boolean argument just didn't seem right. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Before, we'd end up formatting ps["foo"] = "bar" { true } as ps.foo = "bar" { true } and older OPA version know how to parse the former, but not the latter. Fixes #5449. Also includes: * format: pass internal options via struct; because adding a third (in some cases fifth) boolean argument just didn't seem right. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
…cy-agent#5450) Before, we'd end up formatting ps["foo"] = "bar" { true } as ps.foo = "bar" { true } and older OPA version know how to parse the former, but not the latter. Fixes open-policy-agent#5449. Also includes: * format: pass internal options via struct; because adding a third (in some cases fifth) boolean argument just didn't seem right. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Before, we'd end up formatting ps["foo"] = "bar" { true } as ps.foo = "bar" { true } and older OPA version know how to parse the former, but not the latter. Fixes #5449. Also includes: * format: pass internal options via struct; because adding a third (in some cases fifth) boolean argument just didn't seem right. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Before, we'd end up formatting
as
and older OPA version know how to parse the former, but not the latter.
Fixes #5449.