From ee341d96374001a221924a3fde15421ab858e553 Mon Sep 17 00:00:00 2001 From: Michael Sorens Date: Sat, 17 Aug 2024 09:10:07 -0700 Subject: [PATCH] cosmetic: fix a few typos (reprise) (#994) * cosmetic: fix assorted typos * cosmetic: fix a few typos (#992) --- build/capabilities.json | 16 ++++++++-------- bundle/regal/ast/ast.rego | 2 +- bundle/regal/result.rego | 4 ++-- bundle/regal/result_test.rego | 12 ++++++------ .../bugs/annotation_without_metadata_test.rego | 2 +- .../regal/rules/idiomatic/use_in_operator.rego | 2 +- .../imports/prefer_package_imports_test.rego | 2 +- .../rules/style/detached_metadata_test.rego | 2 +- bundle/regal/rules/style/messy_rule_test.rego | 6 +++--- bundle/regal/rules/style/todo_comment_test.rego | 4 ++-- docs/custom-rules.md | 6 +++--- docs/language-server.md | 2 +- docs/rules/idiomatic/use-contains.md | 4 ++-- docs/rules/style/default-over-else.md | 6 +++--- docs/rules/testing/print-or-trace-call.md | 2 +- .../ast_type_failure/custom_type_fail.rego | 2 +- e2e/testdata/not_rego_v1/not_rego_v1.rego | 2 +- e2e/testdata/violations/most_violations.rego | 2 +- internal/ast/rule.go | 2 +- internal/lsp/lint.go | 2 +- 20 files changed, 41 insertions(+), 41 deletions(-) diff --git a/build/capabilities.json b/build/capabilities.json index c65032f4..f33379a9 100644 --- a/build/capabilities.json +++ b/build/capabilities.json @@ -1810,7 +1810,7 @@ } ], "result": { - "description": "deseralized from `x`", + "description": "deserialized from `x`", "name": "y", "type": "string" }, @@ -3089,7 +3089,7 @@ } ], "result": { - "description": "the term deseralized from `x`", + "description": "the term deserialized from `x`", "name": "y", "type": "any" }, @@ -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" ], @@ -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" ], @@ -4794,7 +4794,7 @@ } ], "result": { - "description": "splitted parts", + "description": "split parts", "dynamic": { "type": "string" }, @@ -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" ], @@ -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" ], @@ -6100,7 +6100,7 @@ } ], "result": { - "description": "the term deseralized from `x`", + "description": "the term deserialized from `x`", "name": "y", "type": "any" }, diff --git a/bundle/regal/ast/ast.rego b/bundle/regal/ast/ast.rego index 89ed73b2..ebe6aee2 100644 --- a/bundle/regal/ast/ast.rego +++ b/bundle/regal/ast/ast.rego @@ -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 diff --git a/bundle/regal/result.rego b/bundle/regal/result.rego index b4187837..2af55588 100644 --- a/bundle/regal/result.rego +++ b/bundle/regal/result.rego @@ -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) @@ -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)), }}}) diff --git a/bundle/regal/result_test.rego b/bundle/regal/result_test.rego index f827f82b..72513fe4 100644 --- a/bundle/regal/result_test.rego +++ b/bundle/regal/result_test.rego @@ -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", @@ -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", @@ -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": [{ diff --git a/bundle/regal/rules/bugs/annotation_without_metadata_test.rego b/bundle/regal/rules/bugs/annotation_without_metadata_test.rego index 495025fc..42de7acc 100644 --- a/bundle/regal/rules/bugs/annotation_without_metadata_test.rego +++ b/bundle/regal/rules/bugs/annotation_without_metadata_test.rego @@ -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 diff --git a/bundle/regal/rules/idiomatic/use_in_operator.rego b/bundle/regal/rules/idiomatic/use_in_operator.rego index 83193fcb..fce9e2a4 100644 --- a/bundle/regal/rules/idiomatic/use_in_operator.rego +++ b/bundle/regal/rules/idiomatic/use_in_operator.rego @@ -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])) } diff --git a/bundle/regal/rules/imports/prefer_package_imports_test.rego b/bundle/regal/rules/imports/prefer_package_imports_test.rego index b15983b7..867fc913 100644 --- a/bundle/regal/rules/imports/prefer_package_imports_test.rego +++ b/bundle/regal/rules/imports/prefer_package_imports_test.rego @@ -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 { diff --git a/bundle/regal/rules/style/detached_metadata_test.rego b/bundle/regal/rules/style/detached_metadata_test.rego index 530ed88a..b5c7ac21 100644 --- a/bundle/regal/rules/style/detached_metadata_test.rego +++ b/bundle/regal/rules/style/detached_metadata_test.rego @@ -67,7 +67,7 @@ package p # METADATA # scope: document -# descriptiom: allow allows +# description: allow allows # METADATA # title: allow diff --git a/bundle/regal/rules/style/messy_rule_test.rego b/bundle/regal/rules/style/messy_rule_test.rego index daff2a88..86a7f2cc 100644 --- a/bundle/regal/rules/style/messy_rule_test.rego +++ b/bundle/regal/rules/style/messy_rule_test.rego @@ -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 @@ -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 @@ -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 } diff --git a/bundle/regal/rules/style/todo_comment_test.rego b/bundle/regal/rules/style/todo_comment_test.rego index b6ff6caf..42b1830a 100644 --- a/bundle/regal/rules/style/todo_comment_test.rego +++ b/bundle/regal/rules/style/todo_comment_test.rego @@ -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", @@ -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", }} } diff --git a/docs/custom-rules.md b/docs/custom-rules.md index 666552c2..ceaf39f7 100644 --- a/docs/custom-rules.md +++ b/docs/custom-rules.md @@ -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 diff --git a/docs/language-server.md b/docs/language-server.md index ccc2b416..d1026a26 100644 --- a/docs/language-server.md +++ b/docs/language-server.md @@ -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 diff --git a/docs/rules/idiomatic/use-contains.md b/docs/rules/idiomatic/use-contains.md index 862929dc..087fb201 100644 --- a/docs/rules/idiomatic/use-contains.md +++ b/docs/rules/idiomatic/use-contains.md @@ -15,7 +15,7 @@ report[item] if { startswith(item, "report") } -# unconditinally add an item to report +# unconditionally add an item to report report["report1"] ``` @@ -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" ``` diff --git a/docs/rules/style/default-over-else.md b/docs/rules/style/default-over-else.md index 7fb576f6..fb9aa0f9 100644 --- a/docs/rules/style/default-over-else.md +++ b/docs/rules/style/default-over-else.md @@ -10,7 +10,7 @@ package policy import rego.v1 -permisisions := ["read", "write"] if { +permissions := ["read", "write"] if { input.user == "admin" } else := ["read"] ``` @@ -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" } ``` diff --git a/docs/rules/testing/print-or-trace-call.md b/docs/rules/testing/print-or-trace-call.md index 635189c4..188460c7 100644 --- a/docs/rules/testing/print-or-trace-call.md +++ b/docs/rules/testing/print-or-trace-call.md @@ -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) } ``` diff --git a/e2e/testdata/ast_type_failure/custom_type_fail.rego b/e2e/testdata/ast_type_failure/custom_type_fail.rego index eefeb00e..eb212761 100644 --- a/e2e/testdata/ast_type_failure/custom_type_fail.rego +++ b/e2e/testdata/ast_type_failure/custom_type_fail.rego @@ -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" diff --git a/e2e/testdata/not_rego_v1/not_rego_v1.rego b/e2e/testdata/not_rego_v1/not_rego_v1.rego index 3ea7295c..1de2797c 100644 --- a/e2e/testdata/not_rego_v1/not_rego_v1.rego +++ b/e2e/testdata/not_rego_v1/not_rego_v1.rego @@ -1,6 +1,6 @@ package legacy -# implict-future-keywords +# implicit-future-keywords import future.keywords use_if { diff --git a/e2e/testdata/violations/most_violations.rego b/e2e/testdata/violations/most_violations.rego index 4150e530..542f1ec1 100644 --- a/e2e/testdata/violations/most_violations.rego +++ b/e2e/testdata/violations/most_violations.rego @@ -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 diff --git a/internal/ast/rule.go b/internal/ast/rule.go index d7a6e538..387f58af 100644 --- a/internal/ast/rule.go +++ b/internal/ast/rule.go @@ -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 { diff --git a/internal/lsp/lint.go b/internal/lsp/lint.go index 9beb596b..ab975764 100644 --- a/internal/lsp/lint.go +++ b/internal/lsp/lint.go @@ -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"`