Skip to content

Conversation

RubenHalman
Copy link
Contributor

@RubenHalman RubenHalman commented Jun 28, 2025

✅ PR Summary: Improve MissingNullHandler Rule Logic

#67

This PR improves the MissingNullHandler rule to avoid false positives in subflows and flows where the result of a Get Records operation is not used within the same flow.

🔧 Changes Made

  • ✅ Added logic to skip null-check enforcement when the result of a recordLookup:
    • Is only passed to an output variable, and
    • Is not used in any downstream flow element (e.g., Assignment, Decision, etc.)
  • ✅ Corrected reference matching by using startsWith(...) to detect field-level usage like GetAnAccount.Name
  • ✅ Preserved original behavior:
    • Flows that use lookup results without a null-check still trigger violations
    • Flows that include proper IsNull == false checks are not flagged

✅ Outcomes

  • 🔒 Eliminates false positives for safe subflow output-only use cases
  • ✅ All existing tests continue to pass
  • 🧪 Added a new test case: No_Missing_Null_Handler.test.ts to validate lookup results that are never used internally

@RubenHalman RubenHalman self-assigned this Jun 28, 2025
@RubenHalman RubenHalman linked an issue Jun 28, 2025 that may be closed by this pull request
}
}

// ✅ Skip check if result is never used inside the flow
Copy link
Contributor Author

@RubenHalman RubenHalman Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This downstream check can perhaps be included in the compiler, or a helper class?

@junners junners merged commit 705741e into master Jun 29, 2025
4 checks passed
@junners junners deleted the missing-null-handler branch June 29, 2025 00:07
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.

MissingNullHandler triggered on subflow output variables
2 participants