Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-124: Fixing VSTHRD111 and .NET SDK code analysis rules #63

Merged
merged 3 commits into from
May 30, 2022
Merged
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
15 changes: 14 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,21 @@ dotnet_code_quality_unused_parameters = non_pubic:suggestion
# Note that currently both IDE* rules and csharp_style_* rules are necessary, because only IDE rules will be enforced
# during build, see: https://github.com/dotnet/roslyn/issues/44201.

# Default severity for analyzer diagnostics with category 'Style' (escalated to build warnings)
# Default severity for analyzer diagnostics for all categories (escalated to build warnings). See
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/categories for the list of categories.
dotnet_analyzer_diagnostic.category-Design.severity = warning
dotnet_analyzer_diagnostic.category-Documentation.severity = warning
dotnet_analyzer_diagnostic.category-Globalization.severity = warning
dotnet_analyzer_diagnostic.category-Interoperability.severity = warning
dotnet_analyzer_diagnostic.category-Maintainability.severity = warning
dotnet_analyzer_diagnostic.category-Naming.severity = warning
dotnet_analyzer_diagnostic.category-Performance.severity = warning
dotnet_analyzer_diagnostic.category-SingleFile.severity = warning
dotnet_analyzer_diagnostic.category-Reliability.severity = warning
dotnet_analyzer_diagnostic.category-Security.severity = warning
dotnet_analyzer_diagnostic.category-Style.severity = warning
dotnet_analyzer_diagnostic.category-Usage.severity = warning
dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning

# IDE0011: Add braces to 'if' statement.
# The "when-multiline:warning" config is not actually for cases when the if body is in another line so we have to turn
Expand Down
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This project is developed by [Lombiq Technologies](https://lombiq.com/). Commerc
When a new version of the .NET SDK comes out then to the following:
- Change the `LangVersion` and `AnalysisLevel` elements in the *Build.props* file to opt in to new language features and analyzers. This does not concern non-SDK-style .NET Framework projects.
- Wait for all analyzers to support the new SDK (primarily the new language features). Then update all packages to latest.
- Check if there are new [code analysis categories](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/categories) that we need to surface warnings for by default in the *.editorconfig* file.

### Adding a new analyzer
When adding a new analyzer package, do the following:
Expand Down
3 changes: 2 additions & 1 deletion general.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
<Rule Id="CA5403" Action="Warning" />
</Rules>
<Rules AnalyzerId="Microsoft.VisualStudio.Threading.Analyzers" RuleNamespace="Microsoft.VisualStudio.Threading.Analyzers">
<Rule Id="VSTHRD111" Action="None" />
<Rule Id="VSTHRD113" Action="Warning" />
<Rule Id="VSTHRD200" Action="None" />
</Rules>
Expand Down Expand Up @@ -429,4 +430,4 @@
<Rule Id="SX1101" Action="Warning" />
<Rule Id="SX1309S" Action="Warning" />
</Rules>
</RuleSet>
</RuleSet>
0liver marked this conversation as resolved.
Show resolved Hide resolved