Skip to content

feat(queries): fix pointless reassignment regal lint issue #7416

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

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

Conversation

cx-artur-ribeiro
Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro commented Mar 30, 2025

Fix pointless reassignment regal lint issue

This PR resolves a Regal lint warning related to pointless variable reassignments by eliminating unnecessary assignments where a variable is directly reassigned without any modification. Since Rego variables are immutable, these reassignments do not affect the behavior of the code and introduce unnecessary complexity. This update improves readability and follows best practices for efficient rule writing.

Reason for Proposed Changes

  • Ensure compliance with Regal Linter’s pointless-reassignment rule;
  • Remove redundant variable assignments that do not contribute to the logic;
  • Improve code clarity and maintainability by directly using values where applicable.

Proposed Changes

  • Removed unnecessary variable reassignments where the variable was immediately used without modification;
  • Refactored rules to directly reference values instead of assigning them to temporary variables;
  • Ensured that the affected policy files pass Regal Linter without pointless reassignment warnings.

Continuation of #7295

I submit this contribution under the Apache-2.0 license.

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

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

@cx-artur-ribeiro cx-artur-ribeiro changed the title feat(queries): fix walk no path regal lint issue feat(queries): fix pointless reassignment regal lint issue Mar 30, 2025
@cx-artur-ribeiro cx-artur-ribeiro marked this pull request as ready for review March 30, 2025 18:12
@cx-artur-ribeiro cx-artur-ribeiro requested a review from a team as a code owner March 30, 2025 18:12
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