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

Fix variable shadowing in utilities.rego to resolve Regal linting error #7728

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

sukeshreddyg
Copy link
Contributor

A reference to the issue / Description of it

The issue was related to a regal lint error in the utilities.rego file where the variable object was used, which conflicts with a built-in function in Rego. This shadowing of a built-in function caused linting issues, potentially leading to unexpected behavior in policy evaluation. The issue required renaming the variable to avoid conflict with the built-in object function in Rego. #7670

https://github.com/ministryofjustice/modernisation-platform/actions/runs/10474087493/job/29007520608#step:5:37

How does this PR fix the problem?

This PR fixes the issue where the variable name object was shadowing a built-in function in Rego. The object variable has been renamed to obj to avoid conflicts with the built-in object function, thereby resolving the var-shadows-builtin linting error reported by regal lint.

How has this been tested?

This change was tested by running the regal lint --format=github policies command locally after the update. No errors were reported, confirming that the variable shadowing issue has been resolved.

Will this deployment impact the platform and / or services on it?

NO

Checklist (check x in [ ] of list items)

  • I have performed a self-review of my own code
  • All checks have passed
  • I have made corresponding changes to the documentation
  • Plan and discussed how it should be deployed to PROD (If needed)

@sukeshreddyg sukeshreddyg requested a review from a team as a code owner August 20, 2024 15:05
Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:

@sukeshreddyg sukeshreddyg enabled auto-merge August 20, 2024 15:07
@sukeshreddyg sukeshreddyg added this pull request to the merge queue Aug 20, 2024
Merged via the queue into main with commit 4367bd0 Aug 20, 2024
5 checks passed
@sukeshreddyg sukeshreddyg deleted the fix/variable-shadowing-in-utilities-rego branch August 20, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants