Fix reversed USERELATIONSHIP argument detection - #382
Open
ArturNawrocki wants to merge 2 commits into
Open
Conversation
Fixes a false positive in the `INACTIVE_RELATIONSHIPS_THAT_ARE_NEVER_ACTIVATED` rule. The current expression detects `USERELATIONSHIP` only when its arguments follow the TOM `From` to `To` relationship order. DAX permits the two relationship columns to be supplied in either order. ## Changes - Check both valid `USERELATIONSHIP` argument orders. - Apply the check to measures and calculation items. - Preserve the existing rule ID, severity and scope. ## Validation Tested with: - `From` to `To` arguments in a measure - reversed arguments in a measure - `From` to `To` arguments in a calculation item - reversed arguments in a calculation item - an unused inactive relationship The unused relationship remains a violation. All four valid `USERELATIONSHIP` cases are recognised. ## Reference https://learn.microsoft.com/en-us/dax/userelationship-function-dax
Small fix to INACTIVE_RELATIONSHIPS_THAT_ARE_NEVER_ACTIVATED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes a false positive in the
INACTIVE_RELATIONSHIPS_THAT_ARE_NEVER_ACTIVATEDrule.The existing regular expression assumes that USERELATIONSHIP arguments
follow the internal TOM From-to-To order. DAX permits the arguments in
either order and swaps reversed arguments automatically.
This change:
RegEx.Escapefor complete DAX column references, preventing tablenames containing regex metacharacters, such as parentheses, from causing
false positives.