Fix variable shadowing in utilities.rego to resolve Regal linting error #7728
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)