Skip to content
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

perf: move config check out of loop #1351

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions bundle/regal/main/main.rego
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ lint.aggregate.violations := aggregate_report if {
}

_rules_to_run[category] contains title if {
file_name_relative_to_root := trim_prefix(input.regal.file.name, concat("", [config.path_prefix, "/"]))

some category, title
config.merged_config.rules[category][title]

config.for_rule(category, title).level != "ignore"

file_name_relative_to_root := trim_prefix(input.regal.file.name, concat("", [config.path_prefix, "/"]))

not config.excluded_file(
category,
title,
Expand Down Expand Up @@ -105,20 +105,15 @@ report contains violation if {

# Check custom rules
report contains violation if {
file_name_relative_to_root := trim_prefix(input.regal.file.name, concat("", [config.path_prefix, "/"]))

some category, title

violation := data.custom.regal.rules[category][title].report[_]

config.for_rule(category, title).level != "ignore"

file_name_relative_to_root := trim_prefix(input.regal.file.name, concat("", [config.path_prefix, "/"]))

not config.excluded_file(
category,
title,
file_name_relative_to_root,
)

not config.excluded_file(category, title, file_name_relative_to_root)
not _ignored(violation, ast.ignore_directives)
}

Expand Down
Loading