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

feat(queries): fix redundant existence check regal lint issue #7380

Open
wants to merge 122 commits into
base: master
Choose a base branch
from

Conversation

ArturRibeiro-CX
Copy link
Contributor

@ArturRibeiro-CX ArturRibeiro-CX commented Mar 7, 2025

Fix redundant existence check regal lint issue

This PR resolves a Regal lint warning related to redundant existence checks by removing unnecessary references that are immediately used in the next expression. Since Rego already evaluates whether a value is defined before using it, these checks serve no purpose and have been removed to improve clarity and maintainability.

Reason for Proposed Changes

  • Ensure compliance with Regal Linter’s redundant-existence-check rule;
  • Eliminate unnecessary checks that do not affect logic but reduce readability;
  • Improve efficiency by allowing Rego’s natural evaluation order to handle undefined values.

Proposed Changes

  • Removed explicit existence checks where the value is directly used in the next expression;
  • Simplified conditions to avoid redundant evaluations;
  • Ensured the affected policy files pass Regal Linter without redundant-existence-check warnings.

Continuation of #7295

I submit this contribution under the Apache-2.0 license.

ArturRibeiro-CX and others added 30 commits February 23, 2025 12:48
@ArturRibeiro-CX ArturRibeiro-CX added feature request Community: new feature request feature New feature query New query feature community Community contribution labels Mar 7, 2025
@ArturRibeiro-CX ArturRibeiro-CX self-assigned this Mar 7, 2025
Copy link
Contributor

github-actions bot commented Mar 7, 2025

kics-logo

KICS version: v2.1.5

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@ArturRibeiro-CX ArturRibeiro-CX marked this pull request as ready for review March 7, 2025 21:01
@ArturRibeiro-CX ArturRibeiro-CX requested a review from a team as a code owner March 7, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution feature request Community: new feature request feature New feature query New query feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant