Fix SMA8001 discard handling and split tests#387
Conversation
- Updated ExplicitNumberDeclarationAnalyzer to ignore variables named `_`. - Split `SMA8001_Violation_OtherVarDeclarationsWithPrimitiveNumbers` into specific test cases for out variables, foreach loops, and deconstructions. - Added test cases for discards in various contexts to ensure they are not flagged.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Finishing TouchesGenerate unit tests (beta)
Simplify code
|
This PR addresses the issue in SMA8001 (ExplicitNumberDeclarationAnalyzer) where discard variables (
_) were being incorrectly flagged when used with primitive numbers.Key changes:
ExplicitNumberDeclarationAnalyzer.cs, theReportIfPrimitiveNumbermethod now checks if the identifier is_and returns early if it is.SMA8001_Violation_OtherVarDeclarationsWithPrimitiveNumbersinSMA8001_ExplicitNumberDeclarationAnalyzerTests.cshas been split into:SMA8001_Violation_OutVarDeclarationSMA8001_Violation_ForEachVariableSMA8001_Violation_DeconstructionSMA8001_Violation_ForEachDeconstructionSMA8001_Violation_DeconstructionWithDiscard(verifies that other variables in the same deconstruction are still flagged)SMA8001_Compliant_OutVarWithDiscardSMA8001_Compliant_ForEachWithDiscardSMA8001_Compliant_DiscardAssignmentAll tests pass, including the new discard scenarios.
PR created automatically by Jules for task 1874049618288757185 started by @sator-imaging