Skip to content

Commit

Permalink
Use config.docs.resolve_url consistently (#813)
Browse files Browse the repository at this point in the history
Instead of hard-coding doc URLs.

Signed-off-by: Anders Eknert <[email protected]>
  • Loading branch information
anderseknert authored Jun 10, 2024
1 parent 99f8463 commit 9091021
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion bundle/regal/rules/bugs/impossible_not_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package regal.rules.bugs["impossible-not_test"]

import rego.v1

import data.regal.config

import data.regal.rules.bugs["impossible-not"] as rule

test_fail_multivalue_not_reference_same_package if {
Expand Down Expand Up @@ -156,7 +158,7 @@ expected := {
"level": "error",
"related_resources": [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/bugs/impossible-not",
"ref": config.docs.resolve_url("$baseUrl/$category/impossible-not", "bugs"),
}],
"title": "impossible-not",
}
Expand Down
3 changes: 2 additions & 1 deletion bundle/regal/rules/bugs/inconsistent_args_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package regal.rules.bugs["inconsistent-args_test"]
import rego.v1

import data.regal.ast
import data.regal.config

import data.regal.rules.bugs["inconsistent-args"] as rule

Expand Down Expand Up @@ -68,7 +69,7 @@ expected := {
"level": "error",
"related_resources": [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/bugs/inconsistent-args",
"ref": config.docs.resolve_url("$baseUrl/$category/inconsistent-args", "bugs"),
}],
"title": "inconsistent-args",
}
Expand Down
8 changes: 5 additions & 3 deletions bundle/regal/rules/imports/circular_import_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package regal.rules.imports["circular-import_test"]

import rego.v1

import data.regal.config

import data.regal.rules.imports["circular-import"] as rule

test_aggregate_rule_empty_if_no_refs if {
Expand Down Expand Up @@ -203,7 +205,7 @@ test_aggregate_report_fails_when_cycle_present if {
"location": {"col": 0, "file": "b.rego", "row": 2},
"related_resources": [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/imports/circular-import",
"ref": config.docs.resolve_url("$baseUrl/$category/circular-import", "imports"),
}],
"title": "circular-import",
}}
Expand All @@ -226,7 +228,7 @@ test_aggregate_report_fails_when_cycle_present_in_1_package if {
"location": {"col": 12, "file": "a.rego", "row": 3},
"related_resources": [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/imports/circular-import",
"ref": config.docs.resolve_url("$baseUrl/$category/circular-import", "imports"),
}],
"title": "circular-import",
}}
Expand Down Expand Up @@ -258,7 +260,7 @@ test_aggregate_report_fails_when_cycle_present_in_n_packages if {
"location": {"col": 12, "file": "c.rego", "row": 3},
"related_resources": [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/imports/circular-import",
"ref": config.docs.resolve_url("$baseUrl/$category/circular-import", "imports"),
}],
"title": "circular-import",
}}
Expand Down
3 changes: 2 additions & 1 deletion bundle/regal/rules/style/double_negative_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package regal.rules.style["double-negative_test"]
import rego.v1

import data.regal.ast
import data.regal.config

import data.regal.rules.style["double-negative"] as rule

Expand All @@ -20,7 +21,7 @@ test_fail_double_negative if {
"location": {"col": 13, "file": "policy.rego", "row": 8, "text": " fine if not not_fine"},
"related_resources": [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/style/double-negative",
"ref": config.docs.resolve_url("$baseUrl/$category/double-negative", "style"),
}],
"title": "double-negative",
"level": "error",
Expand Down
4 changes: 3 additions & 1 deletion bundle/regal/rules/style/rule_name_repeats_package_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package regal.rules.style["rule-name-repeats-package_test"]

import rego.v1

import data.regal.config

import data.regal.rules.style["rule-name-repeats-package"] as rule

related_resources := [{
"description": "documentation",
"ref": "https://docs.styra.com/regal/rules/style/rule-name-repeats-package",
"ref": config.docs.resolve_url("$baseUrl/$category/rule-name-repeats-package", "style"),
}]

base_result := {
Expand Down

0 comments on commit 9091021

Please sign in to comment.