Skip to content

Commit

Permalink
cosmetic: fix a few typos (reprise) (#994)
Browse files Browse the repository at this point in the history
* cosmetic: fix assorted typos

* cosmetic: fix a few typos (#992)
  • Loading branch information
msorens authored Aug 17, 2024
1 parent 1e14d08 commit ee341d9
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 41 deletions.
16 changes: 8 additions & 8 deletions build/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@
}
],
"result": {
"description": "deseralized from `x`",
"description": "deserialized from `x`",
"name": "y",
"type": "string"
},
Expand Down Expand Up @@ -3089,7 +3089,7 @@
}
],
"result": {
"description": "the term deseralized from `x`",
"description": "the term deserialized from `x`",
"name": "y",
"type": "any"
},
Expand Down Expand Up @@ -4187,7 +4187,7 @@
},
{
"name": "product",
"description": "Muliplies elements of an array or set of numbers",
"description": "Multiplies elements of an array or set of numbers",
"categories": [
"aggregates"
],
Expand Down Expand Up @@ -4274,7 +4274,7 @@
},
{
"name": "rand.intn",
"description": "Returns a random integer between `0` and `n` (`n` exlusive). If `n` is `0`, then `y` is always `0`. For any given argument pair (`str`, `n`), the output will be consistent throughout a query evaluation.",
"description": "Returns a random integer between `0` and `n` (`n` exclusive). If `n` is `0`, then `y` is always `0`. For any given argument pair (`str`, `n`), the output will be consistent throughout a query evaluation.",
"categories": [
"numbers"
],
Expand Down Expand Up @@ -4794,7 +4794,7 @@
}
],
"result": {
"description": "splitted parts",
"description": "split parts",
"dynamic": {
"type": "string"
},
Expand Down Expand Up @@ -5602,7 +5602,7 @@
},
{
"name": "trim_left",
"description": "Returns `value` with all leading instances of the `cutset` chartacters removed.",
"description": "Returns `value` with all leading instances of the `cutset` characters removed.",
"categories": [
"strings"
],
Expand Down Expand Up @@ -5656,7 +5656,7 @@
},
{
"name": "trim_right",
"description": "Returns `value` with all trailing instances of the `cutset` chartacters removed.",
"description": "Returns `value` with all trailing instances of the `cutset` characters removed.",
"categories": [
"strings"
],
Expand Down Expand Up @@ -6100,7 +6100,7 @@
}
],
"result": {
"description": "the term deseralized from `x`",
"description": "the term deserialized from `x`",
"name": "y",
"type": "any"
},
Expand Down
2 changes: 1 addition & 1 deletion bundle/regal/ast/ast.rego
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function_arg_names(rule) := [arg.value | some arg in rule.head.args]
rule_and_function_names contains ref_to_string(rule.head.ref) if some rule in input.rules

# METADATA
# description: all identifers in the input AST (rule and functiin names, plus imported names)
# description: all identifiers in the input AST (rule and function names, plus imported names)
identifiers := rule_and_function_names | imported_identifiers

# METADATA
Expand Down
4 changes: 2 additions & 2 deletions bundle/regal/result.rego
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fail(metadata, details) := _fail_annotated(metadata, details)
# METADATA
# description: |
# creates a notice object, i.e. one used to inform users of things like a rule getting
# ignored because the set capabilities does not include a dependency (like a buiöt-in function)
# ignored because the set capabilities does not include a dependency (like a built-in function)
# needed by the rule
notice(metadata) := result if {
is_array(metadata)
Expand Down Expand Up @@ -220,7 +220,7 @@ ranged_location_from_text(x) := end if {
loc := location(x)
end := object.union(loc, {"location": {"end": {
# note the use of the _original_ location text here, as loc.location.text
# will be the entire line where the violation occured
# will be the entire line where the violation occurred
"row": (loc.location.row + count(lines)) - 1,
"col": loc.location.col + count(regal.last(lines)),
}}})
Expand Down
12 changes: 6 additions & 6 deletions bundle/regal/result_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import data.regal.result

test_no_related_resources_in_result_fail_on_custom_rule_unless_provided if {
chain := [
{"path": ["custom", "regal", "rules", "categoy", "name", "report"]},
{"path": ["custom", "regal", "rules", "category", "name", "report"]},
{
"annotations": {
"scope": "package",
"description": "This is a test",
},
"path": ["custom", "regal", "rules", "categoy", "name"],
"path": ["custom", "regal", "rules", "category", "name"],
},
]

violation := result.fail(chain, {})

violation == {
"category": "categoy",
"category": "category",
"description": "This is a test",
"level": "error",
"title": "name",
Expand All @@ -29,7 +29,7 @@ test_no_related_resources_in_result_fail_on_custom_rule_unless_provided if {

test_related_resources_in_result_fail_on_custom_rule_when_provided if {
chain := [
{"path": ["custom", "regal", "rules", "categoy", "name", "report"]},
{"path": ["custom", "regal", "rules", "category", "name", "report"]},
{
"annotations": {
"scope": "package",
Expand All @@ -39,14 +39,14 @@ test_related_resources_in_result_fail_on_custom_rule_when_provided if {
"ref": "https://example.com",
}],
},
"path": ["custom", "regal", "rules", "categoy", "name"],
"path": ["custom", "regal", "rules", "category", "name"],
},
]

violation := result.fail(chain, {})

violation == {
"category": "categoy",
"category": "category",
"description": "This is a test",
"level": "error",
"related_resources": [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ allow := false # title: allow
r == set()
}

test_success_annotation_without_metadata_but_comment_preceeding if {
test_success_annotation_without_metadata_but_comment_preceding if {
module := ast.with_rego_v1(`
# something that is not an annotation here will cancel this rule
# as this is less likely to be a mistake... but weird
Expand Down
2 changes: 1 addition & 1 deletion bundle/regal/rules/idiomatic/use_in_operator.rego
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ report contains violation if {
nlt := nl_terms[0]
static_term(nlt.term)

# Use the non-loop term positon to determine the
# Use the non-loop term position to determine the
# location of the loop term (3 is the count of terms)
violation := result.fail(rego.metadata.chain(), result.location(terms[3 - nlt.pos]))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test_success_aggregate_report_on_import_with_matching_package if {
r == set()
}

# unresolved imports should be flagged by an `unresoled-import`
# unresolved imports should be flagged by an `unresolved-import`
# rule instead. see https://github.com/StyraInc/regal/issues/300
test_success_aggregate_report_on_import_with_unresolved_path if {
r := rule.aggregate_report with input.aggregate as {
Expand Down
2 changes: 1 addition & 1 deletion bundle/regal/rules/style/detached_metadata_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ package p
# METADATA
# scope: document
# descriptiom: allow allows
# description: allow allows
# METADATA
# title: allow
Expand Down
6 changes: 3 additions & 3 deletions bundle/regal/rules/style/messy_rule_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test_fail_messy_default_definition if {
r == expected_with_location({"col": 2, "file": "policy.rego", "row": 10, "text": "\tfoo if 5 == 1"})
}

test_fail_messy_nested_rule_definiton if {
test_fail_messy_nested_rule_definition if {
module := ast.with_rego_v1(`
base.foo if true
Expand All @@ -59,7 +59,7 @@ test_fail_messy_nested_rule_definiton if {
r == expected_with_location({"col": 2, "file": "policy.rego", "row": 10, "text": "\tbase.foo if 5 == 1"})
}

test_success_non_incremental_nested_rule_definiton if {
test_success_non_incremental_nested_rule_definition if {
module := ast.with_rego_v1(`
base.foo if true
Expand All @@ -85,7 +85,7 @@ test_success_non_messy_ref_head_rules if {
r == set()
}

test_fail_messy_incremental_nested_variable_rule_definiton if {
test_fail_messy_incremental_nested_variable_rule_definitiion if {
module := ast.with_rego_v1(`
base[x].foo := 5 if { x := 1 }
Expand Down
4 changes: 2 additions & 2 deletions bundle/regal/rules/style/todo_comment_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import data.regal.config
import data.regal.rules.style["todo-comment"] as rule

test_fail_todo_comment if {
r := rule.report with input as ast.policy(`# TODO: do someting clever`)
r := rule.report with input as ast.policy(`# TODO: do something clever`)
r == {{
"category": "style",
"description": "Avoid TODO comments",
Expand All @@ -16,7 +16,7 @@ test_fail_todo_comment if {
"ref": config.docs.resolve_url("$baseUrl/$category/todo-comment", "style"),
}],
"title": "todo-comment",
"location": {"col": 1, "file": "policy.rego", "row": 3, "text": `# TODO: do someting clever`},
"location": {"col": 1, "file": "policy.rego", "row": 3, "text": `# TODO: do something clever`},
"level": "error",
}}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/custom-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ aggregate contains entry if {
# ast.rules is input.rules with functions filtered out
some rule in ast.rules
# search for rule named alllow
# search for rule named allow
ast.name(rule) == "allow"
# make sure it's a default assignemnt
# ideally we'll want more than that, but the *requiremnt* is only
# make sure it's a default assignment
# ideally we'll want more than that, but the *requirement* is only
# that such a rule exists...
rule["default"] == true
Expand Down
2 changes: 1 addition & 1 deletion docs/language-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ the way it did, or where rule evaluation failed.
Policy evaluation often depends on **input**. This can be provided via an `input.json` file which Regal will search
for first in the same directory as the policy file evaluated. If not found there, Regal will proceed to search each
parent directory up until the workspace root directory. It is recommended to add `input.json` to your `.gitignore`
file so that you can work freely with evaluation in any directory without having your input accidentally commited.
file so that you can work freely with evaluation in any directory without having your input accidentally committed.

#### Editor support

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/idiomatic/use-contains.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ report[item] if {
startswith(item, "report")
}
# unconditinally add an item to report
# unconditionally add an item to report
report["report1"]
```

Expand All @@ -32,7 +32,7 @@ report contains item if {
startswith(item, "report")
}
# unconditinally add an item to report
# unconditionally add an item to report
report contains "report1"
```

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/style/default-over-else.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package policy
import rego.v1
permisisions := ["read", "write"] if {
permissions := ["read", "write"] if {
input.user == "admin"
} else := ["read"]
```
Expand All @@ -21,9 +21,9 @@ package policy
import rego.v1
default permisisions := ["read"]
default permissions := ["read"]
permisisions := ["read", "write"] if {
permissions := ["read", "write"] if {
input.user == "admin"
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/testing/print-or-trace-call.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ reasons contains sprintf("%q is a dog!", [user.name]) if {
some user in input.users
user.species == "canine"
# Useful for debugging, but leave out before commiting
# Useful for debugging, but leave out before committing
print("user:", user)
}
```
Expand Down
2 changes: 1 addition & 1 deletion e2e/testdata/ast_type_failure/custom_type_fail.rego
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package custom.regal.rules.naming.type_fail
import rego.v1

report contains foo if {
# There is no "foo" attrinbute in the AST,
# There is no "foo" attribute in the AST,
# so this should fail at compile time
foo := input.foo
foo == "bar"
Expand Down
2 changes: 1 addition & 1 deletion e2e/testdata/not_rego_v1/not_rego_v1.rego
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package legacy

# implict-future-keywords
# implicit-future-keywords
import future.keywords

use_if {
Expand Down
2 changes: 1 addition & 1 deletion e2e/testdata/violations/most_violations.rego
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# METADATA
# description: |
# This file is used for e2e tests of most of the provided linter rules. All violations can't
# be tested in a single file, as some are mutually exlusive (i.e. implicit-future-keywords and
# be tested in a single file, as some are mutually exclusive (i.e. implicit-future-keywords and
# rule-named-if).
package all_violations

Expand Down
2 changes: 1 addition & 1 deletion internal/ast/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// GetRuleDetail returns a short descriptive string value for a given rule stating
// if the rule is contstant, multi-value, single-value etc and the type of the rule's
// if the rule is constant, multi-value, single-value etc and the type of the rule's
// value if known.
func GetRuleDetail(rule *ast.Rule) string {
if rule.Head.Args != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func updateAllDiagnostics(
return nil
}

// astError is copied from OPA but drop details as I (charlieegan3) had issues unmarsalling the field.
// astError is copied from OPA but drop details as I (charlieegan3) had issues unmarshalling the field.
type astError struct {
Code string `json:"code"`
Message string `json:"message"`
Expand Down

0 comments on commit ee341d9

Please sign in to comment.