Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ jobs:
- name: dotnet build SDK
run: dotnet build ./src/MSBuild.Sdk.SqlProj/MSBuild.Sdk.SqlProj.csproj -c Release

# Verify .editorconfig-backed analyzer rule overrides
- name: validate editorconfig rules
run: bash ./test/validate-editorconfig-rules.sh

# Verify generated create scripts are copied to referencing project outputs
- name: validate generated create script copy
run: bash ./test/validate-generated-create-script-copy.sh
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,23 @@ A xml file with the analysis results is created in the output folder.

The optional `CodeAnalysisRules` property allows you to disable individual rules or groups of rules for the entire project.

The SDK also reads `.editorconfig` severity entries for SQL analysis rules from the project directory and its parent directories. Supported mappings are:

- `dotnet_diagnostic.<Assembly>.<RuleId>.severity = error` to report that rule as an error
- `dotnet_diagnostic.<Assembly>.<RuleId>.severity = none` to suppress that rule

For example:

```ini
[*.sql]
dotnet_diagnostic.SqlServer.Rules.SRD0006.severity = error
dotnet_diagnostic.SqlServer.Rules.SRD0002.severity = none
```

Use the fully qualified rule name in `.editorconfig`, for example `SqlServer.Rules.SRD0006`. Non-qualified rule IDs are ignored with a warning so analyzer packages cannot conflict on the same short `RuleId`.

The current implementation applies entries from `[*]`, `[*.*]`, `[*.sql]`, `[**.sql]`, and `[**/*.sql]` sections. If `.editorconfig`, and `CodeAnalysisRules`, are used, they are combined.

Starting with version 3.0.0 of the SDK, you can also disable rules per file. Add a `StaticCodeAnalysis.SuppressMessages.xml` file to the project root, with contents similar to this:

```xml
Expand Down
Loading
Loading