Skip to content

Commit

Permalink
fix opa-fmt and fix config file with proper links to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturRibeiro-CX committed Nov 10, 2024
1 parent 8fa67a6 commit 2af6f1a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
27 changes: 15 additions & 12 deletions assets/.regal/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
rules:
bugs:
not-equals-in-loop:
# https://docs.styra.com/regal/rules/bugs/not-equals-in-loop
level: ignore
rule-shadows-builtin:
# https://docs.styra.com/regal/rules/bugs/rule-shadows-builtin
level: warn
idiomatic:
no-defined-entrypoint:
Expand All @@ -11,46 +13,47 @@ rules:
level: ignore
# temporary
non-raw-regex-pattern:
# https://docs.styra.com/regal/rules/idiomatic/non-raw-regex-pattern
# removing redundant escaping from regexes would provide better readability
level: warn
use-in-operator:
# https://docs.styra.com/regal/rules/idiomatic/use-in-operator
# 42 violations — this would be good to fix, but not critical
level: warn
use-some-for-output-vars:
# https://docs.styra.com/regal/rules/idiomatic/use-some-for-output-vars
# These would be good to address, but would require a concentrated effort
level: ignore
equals-pattern-matching:
level: ignore
no-undefined-references:
level: warn
consistent-naming:
level: warn
style:
avoid-get-and-list-prefix:
# https://docs.styra.com/regal/rules/style/avoid-get-and-list-prefix
level: ignore
external-reference:
# https://docs.styra.com/regal/rules/style/external-reference
level: ignore
file-length:
# https://docs.styra.com/regal/rules/style/file-length
level: ignore
line-length:
# https://docs.styra.com/regal/rules/style/line-length
level: ignore
no-whitespace-comment:
level: ignore
# https://docs.styra.com/regal/rules/style/no-whitespace-comment
level: warn
opa-fmt:
# https://docs.styra.com/regal/rules/style/opa-fmt
level: error
prefer-some-in-iteration:
# https://docs.styra.com/regal/rules/style/prefer-some-in-iteration
level: warn
prefer-snake-case:
# https://docs.styra.com/regal/rules/style/prefer-snake-case
level: ignore
rule-length:
# https://docs.styra.com/regal/rules/style/rule-length
level: ignore
todo-comment:
# https://docs.styra.com/regal/rules/style/todo-comment
level: ignore
no-trailing-whitespace:
level: warn
alphabetical-order:
level: warn
use-assignment-operator:
# https://docs.styra.com/regal/rules/style/use-assignment-operator
level: ignore
2 changes: 1 addition & 1 deletion assets/libraries/ansible.rego
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ isPortInRule(rule, portNumber) {
}

isPortInRule(rule, portNumber) {
rule.ports[_] == portNumber
portNumber in rule.ports
}

isPortInRule(rule, portNumber) {
Expand Down
2 changes: 1 addition & 1 deletion assets/libraries/openapi.rego
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ is_operation(path) = info {

is_numeric_type(type) {
numeric := {"integer", "number"}
type == numeric[_]
type in numeric
}

# It verifies if the string schema does not have the 'field' defined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CxPolicy[result] {
kinds := {"Role", "ClusterRole"}
document.kind in kinds

"impersonate" in document.rules[j].verbs
"impersonate" in document.rules[j].verbs

result := {
"documentId": document.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CxPolicy[result] {
document.kind in kinds

verbs := {"update", "patch", "create", "*"}
document.rules[j].resources[_] == "pods/portforward"
"pods/portforward" in document.rules[j].resources
document.rules[j].verbs[_] == verbs[_]

result := {
Expand Down

0 comments on commit 2af6f1a

Please sign in to comment.