microsoft / microsoft/vscode-mssql

Warn in the Code Analysis dialog when the rules package is out of sync with the .sqlproj

Open
#22,649 0 comments 0 reactions 1 assignee Claimed by @ssreerama View on GitHub
Dominant language
TypeScript
Stars
1.9k
Forks
610
Avg merge
2d 3h
Merged PRs (30d)
97

Description

## Problem

Custom code analysis rules come from NuGet analyzer packages and are only discoverable once those packages have been restored. If the restored package is missing, or is a different version than the one referenced in the `.sqlproj`, the rule list in the Code Analysis dialog can be stale or incomplete — and nothing in the UI tells the user why.

This is easy to reproduce: reference a package version that is not available locally and restore.

```
error NU1102: Unable to find package SampleRules with version (>= 1.0.4)
- Found 1 version(s) in local-sampleRules [ Nearest version: 1.0.3 ]

Restore failed with 1 error(s) in 4.8s
```

At that point the dialog will show whatever rules were last resolvable, with no indication that they do not match the `.sqlproj`.

## Proposed work

Show a warning in the Code Analysis dialog when the analyzer package is out of sync, with a button that runs the restore and then refreshes the rule list.

The dialog already has most of the plumbing:

- `CodeAnalysisState.message?: DialogMessageSpec` renders a message bar
- `DialogMessageSpec` already supports `intent` (so `warning` works) and `buttons: DialogMessageButtonSpec[]`

So the remaining work is:

- detecting the mismatch (see questions below)
- a new reducer in `CodeAnalysisReducers` to trigger the restore
- refreshing the rules once the restore completes

Now that #22648 has landed a `restoreProject` method on `ProjectsController`, the button should be able to reuse it rather than shelling out separately.

## Acceptance criteria

- [ ] The Code Analysis dialog shows a warning when the analyzer package is out of sync with the `.sqlproj`
- [ ] The warning includes a button that runs the restore
- [ ] The rule list refreshes once the restore succeeds
- [ ] A failed restore is surfaced rather than silently leaving the warning in place
- [ ] All new user-facing strings are localized
- [ ] Unit tests cover the mismatch detection and the refresh-after-restore flow

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.