Skip to content

Commit

Permalink
Update Regal to v0.23.1 (#1159)
Browse files Browse the repository at this point in the history
Also:
- Remove rules from config that aren't needed
- Add configuration for new rules (only 'messy-rule' needed)
- Fix 'identically-named-tests' violation by renaming the tests

Signed-off-by: Anders Eknert <[email protected]>
  • Loading branch information
anderseknert authored Aug 1, 2024
1 parent c9875d5 commit 64b3531
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit_test_opa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ jobs:
- name: Setup Regal
uses: StyraInc/[email protected]
with:
version: v0.18.0
version: v0.23.1
- name: Run Regal Lint
run: regal lint --format github ${{ env.MODULE_ROOT }}/Rego ${{ env.MODULE_ROOT }}/Testing
33 changes: 8 additions & 25 deletions .regal/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
# All rules documented here:
# https://docs.styra.com/regal/category/rules
rules:
bugs:
# https://docs.styra.com/regal/rules/bugs/constant-condition
constant-condition:
# Many rule bodies containing only `true`. This is
# redundant, as that's the implied rule body when
# none is provided. It's harmless, but should be
# fixed anyway so real issues aren't missed.
level: warning
custom:
# https://docs.styra.com/regal/rules/custom/naming-convention
naming-convention:
Expand All @@ -35,10 +27,6 @@ rules:
# Safe to ignore.
level: ignore
imports:
implicit-future-keywords:
# This rule is on it's way out anyway, as future
# versions of OPA will make these keywords standard.
level: ignore
# https://docs.styra.com/regal/rules/imports/prefer-package-imports
prefer-package-imports:
# Mostly just a style preference, motivated by how
Expand All @@ -62,19 +50,23 @@ rules:
max-line-length: 150
non-breakable-word-threshold: 100
level: warning
# https://docs.styra.com/regal/rules/style/messy-rule
messy-rule:
# This rule suggests grouping incremental rules together, which
# might be worth considering for readability, but certainly not
# critical.
level: ignore
# https://docs.styra.com/regal/rules/style/no-whitespace-comment
no-whitespace-comment:
# This repo is actually good about this, but frequently
# uses '#--' as a delimiter of sorts. That should be OK,
# and the next version of Regal will allow for exceptions
# like this: https://github.com/StyraInc/regal/issues/379
level: ignore
level: warning
except-pattern: '^--|^gitleaks:'
# https://docs.styra.com/regal/rules/style/opa-fmt
opa-fmt:
level: ignore
# https://docs.styra.com/regal/rules/style/prefer-some-in-iteration
prefer-some-in-iteration:
level: warning
# https://docs.styra.com/regal/rules/style/prefer-snake-case
prefer-snake-case:
# This is the default style preference for Rego, but since
Expand All @@ -92,12 +84,3 @@ rules:
# https://docs.styra.com/regal/rules/style/todo-comment
todo-comment:
level: ignore
testing:
# https://docs.styra.com/regal/rules/testing/identically-named-tests
identically-named-tests:
# Only a few of these — would be easy to fix
level: warning
# https://docs.styra.com/regal/rules/testing/test-outside-test-package
test-outside-test-package:
# This is just a style preference
level: warning
2 changes: 1 addition & 1 deletion PowerShell/ScubaGear/Rego/AADConfig.rego
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ GlobalAdmins contains User.DisplayName if {
"Global Administrator" in User.roles
}

#Set conditions under which this policy will pass
# Set conditions under which this policy will pass
default IsGlobalAdminCountGood := false
IsGlobalAdminCountGood := true if {
count(GlobalAdmins) <= 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ test_ContentContainsSensitiveInformation_Incorrect_V6 if {
TestResult("MS.DEFENDER.4.1v1", Output, ReportDetailString, false) == true
}

test_NoDLPLicense_Incorrect_V1 if {
test_NoDLPLicense_Incorrect_4_1_V1 if {
Output := defender.tests with input as {
"defender_license": false,
"defender_dlp_license": false
Expand Down Expand Up @@ -871,7 +871,7 @@ test_Locations_Incorrect_V8 if {
TestResult("MS.DEFENDER.4.2v1", Output, ReportDetailString, false) == true
}

test_NoDLPLicense_Incorrect_V1 if {
test_NoDLPLicense_Incorrect_4_2_V1 if {
Output := defender.tests with input as {
"defender_license": false,
"defender_dlp_license": false
Expand Down Expand Up @@ -1161,7 +1161,7 @@ test_BlockAccess_Incorrect_V6 if {
TestResult("MS.DEFENDER.4.3v1", Output, ReportDetailString, false) == true
}

test_NoDLPLicense_Incorrect_V1 if {
test_NoDLPLicense_Incorrect_4_3_V1 if {
Output := defender.tests with input as {
"defender_license": false,
"defender_dlp_license": false
Expand Down Expand Up @@ -1307,7 +1307,7 @@ test_NotifyUser_Incorrect_V2 if {
TestResult("MS.DEFENDER.4.4v1", Output, ReportDetailString, false) == true
}

test_NoDLPLicense_Incorrect_V1 if {
test_NoDLPLicense_Incorrect_4_4_V1 if {
Output := defender.tests with input as {
"defender_license": false,
"defender_dlp_license": false
Expand Down

0 comments on commit 64b3531

Please sign in to comment.