Skip to content

Fix SMA8001 discard handling and split tests#387

Open
google-labs-jules[bot] wants to merge 1 commit into
work/update-explicit-number-analyzerfrom
fix-sma8001-discard-handling-and-test-split-1874049618288757185
Open

Fix SMA8001 discard handling and split tests#387
google-labs-jules[bot] wants to merge 1 commit into
work/update-explicit-number-analyzerfrom
fix-sma8001-discard-handling-and-test-split-1874049618288757185

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

This PR addresses the issue in SMA8001 (ExplicitNumberDeclarationAnalyzer) where discard variables (_) were being incorrectly flagged when used with primitive numbers.

Key changes:

  • In ExplicitNumberDeclarationAnalyzer.cs, the ReportIfPrimitiveNumber method now checks if the identifier is _ and returns early if it is.
  • The large test case SMA8001_Violation_OtherVarDeclarationsWithPrimitiveNumbers in SMA8001_ExplicitNumberDeclarationAnalyzerTests.cs has been split into:
    • SMA8001_Violation_OutVarDeclaration
    • SMA8001_Violation_ForEachVariable
    • SMA8001_Violation_Deconstruction
    • SMA8001_Violation_ForEachDeconstruction
  • New test cases have been added to verify discard behavior:
    • SMA8001_Violation_DeconstructionWithDiscard (verifies that other variables in the same deconstruction are still flagged)
    • SMA8001_Compliant_OutVarWithDiscard
    • SMA8001_Compliant_ForEachWithDiscard
    • SMA8001_Compliant_DiscardAssignment

All tests pass, including the new discard scenarios.


PR created automatically by Jules for task 1874049618288757185 started by @sator-imaging

- 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.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a68f693-f6a8-4586-8f0f-d31cb04cb108

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
Finishing Touches
Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-sma8001-discard-handling-and-test-split-1874049618288757185
Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix-sma8001-discard-handling-and-test-split-1874049618288757185

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.

0 participants