Skip to content

SLVS-1236 Add Change status option to editor quick actions - #6682

Open
georgii-borovinskikh-sonarsource wants to merge 3 commits into
masterfrom
gb/mute-issue-quick-fix
Open

SLVS-1236 Add Change status option to editor quick actions#6682
georgii-borovinskikh-sonarsource wants to merge 3 commits into
masterfrom
gb/mute-issue-quick-fix

Conversation

@georgii-borovinskikh-sonarsource

Copy link
Copy Markdown
Member

Part of

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Apr 10, 2026

Copy link
Copy Markdown

SLVS-1236

@sonar-review-alpha

sonar-review-alpha Bot commented Apr 10, 2026

Copy link
Copy Markdown

Summary

This PR adds a "Change status" quick action option to the SonarLint editor, complementing the existing quick fixes functionality. The changes include:

Core Implementation:

  • New ChangeStatusActionsSource and ChangeStatusActionsSourceProvider to enable status-change suggestions in the editor's light bulb menu
  • New ChangeStatusSuggestedAction to execute status changes when selected

Refactoring:

  • Extracted common logic from QuickFixActionsSource into a new abstract base class IssueActionsSourceBase to avoid duplication and reduce maintenance burden
  • QuickFixActionsSource now inherits from this base, using a primary constructor and delegating boilerplate to the base class

Dependencies:

  • Added 4 new Visual Studio assembly references to support the quick actions framework (CoreUtility, Language.Intellisense, Text.Logic, Text.UI)

Testing:

  • Added comprehensive unit tests for the new classes and the refactored QuickFixActionsSource

What reviewers should know

Where to start:

  1. Review the new abstract base class IssueActionsSourceBase first — it defines the pattern both quick-fix and change-status actions follow
  2. Then examine ChangeStatusActionsSource — the core new feature that implements issue status changes
  3. Verify the refactored QuickFixActionsSource behaves identically to before (the inheritance change is mostly code motion)

Non-obvious design decisions:

  • The base class uses abstract methods (TryGetMatchingIssues, CreateActions, Priority) to let subclasses customize behavior while sharing tag aggregation, event handling, and error handling logic
  • ChangeStatusActionsSource filters issues differently than quick fixes (by mute status rather than available fixes)

Key areas to watch:

  • Assembly reference additions — verify they're compatible with the minimum VS version target
  • The refactored QuickFixActionsSource uses a primary constructor; confirm tests validate existing functionality is preserved
  • Priority levels differ between quick fixes (Medium) and change status (check the implementation)
  • IssueActionsSourceBase handles SuggestedActionsChanged event firing — verify no race conditions if tags change while actions are being computed

  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

sonar-review-alpha[bot]

This comment was marked as outdated.

@sonar-review-alpha sonar-review-alpha Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One real bug to fix before merge: taint issues can appear in the new quick action but are always resolved as non-taint issues.

SonarQube Cloud quality gate is failing — 5 new issues need to be resolved. See the reviewer guide above for details. The two MAJOR findings (IssueActionsSourceBase IDisposable pattern and the obsolete SuggestedActionSet constructor) are worth addressing given they're in newly introduced production code.

🗣️ Give feedback

return;
}

muteIssuesService.ResolveIssueWithDialog(issueVisualization.IssueServerKey, isTaintIssue: false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

isTaintIssue: false is hardcoded, but this action will also be offered for taint issues.

ChangeStatusActionsSource.TryGetMatchingIssues filters only on !IsResolved && IssueServerKey != null. Taint issues satisfy both conditions — they always have a server key (set in TaintStore) and can be unresolved. The AggregatingIssueLocationStoreAdapter aggregates taint issues alongside regular ones, so they appear in the same IIssueLocationTag stream.

When a user clicks "Change status" on a taint issue, this calls the regular-issue review path (isTaintIssue: false) instead of the taint review path — exactly the opposite of what TaintsReportViewModel does for the same operation.

Two valid fixes depending on intent:

  • If taint issues are out of scope, exclude them in ChangeStatusActionsSource.TryGetMatchingIssues:
    matchingIssues = issueVisualizations
        .Where(x => !x.IsResolved && x.IssueServerKey != null && x.Issue is not ITaintIssue);
  • If taint issues should also be handled, detect the type in Invoke and pass the correct flag.
Suggested change
muteIssuesService.ResolveIssueWithDialog(issueVisualization.IssueServerKey, isTaintIssue: false);
muteIssuesService.ResolveIssueWithDialog(issueVisualization.IssueServerKey, isTaintIssue: issueVisualization.Issue is ITaintIssue);
  • Mark as noise

@sonarqubecloud

sonarqubecloud Bot commented Apr 13, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sonar-review-alpha sonar-review-alpha Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The previously flagged isTaintIssue: false hardcoded issue in ChangeStatusSuggestedAction.Invoke remains unaddressed.

SonarQube Cloud status — SonarQube Cloud quality gate is failing with 2 new issues. See the reviewer guide above for details.

🗣️ Give feedback

return;
}

muteIssuesService.ResolveIssueWithDialog(issueVisualization.IssueServerKey, isTaintIssue: false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

isTaintIssue: false is still hardcoded. ChangeStatusActionsSource.TryGetMatchingIssues filters only on !IsResolved && IssueServerKey != null, which taint issues satisfy. When a user clicks "Change status" on a taint issue, the wrong review path is invoked.

Either exclude taint issues at the filter level in ChangeStatusActionsSource:

.Where(x => !x.IsResolved && x.IssueServerKey != null && x.Issue is not ITaintIssue)

Or pass the correct flag at the call site:

Suggested change
muteIssuesService.ResolveIssueWithDialog(issueVisualization.IssueServerKey, isTaintIssue: false);
muteIssuesService.ResolveIssueWithDialog(issueVisualization.IssueServerKey, isTaintIssue: issueVisualization.Issue is ITaintIssue);
  • Mark as noise

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.

1 participant