https://github.com/cezarypiatek/dotnetcodeanalysisessentialsetup
A quick guideline how to setup static code analysis for dotnet project with a list of essential analyzer packages.
https://github.com/cezarypiatek/dotnetcodeanalysisessentialsetup
Last synced: 7 months ago
JSON representation
A quick guideline how to setup static code analysis for dotnet project with a list of essential analyzer packages.
- Host: GitHub
- URL: https://github.com/cezarypiatek/dotnetcodeanalysisessentialsetup
- Owner: cezarypiatek
- License: mit
- Created: 2023-02-05T08:57:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-05T10:06:00.000Z (over 2 years ago)
- Last Synced: 2025-01-17T05:43:44.306Z (9 months ago)
- Size: 579 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dotnet code analysis essential setup
A quick guideline how to setup static code analysis for dotnet project with a list of essential analyzer packages.[Overview of .NET source code analysis](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview?tabs=net-7)
## How to enable built-in static code analysis
Add [Directory.Build.props](https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022) file with the content as below in the same directory as solution file:
```xml
true
true
Recommended
all
runtime; build; native; contentfiles; analyzers
```
## How to setup severity for a particular rule
### Using dedicated editor for .editorconfig

### Using solution explorer

### Directly from code editor

### Manually edit `.editorconfig` file
If you are not using VisualStudio then you can configure specific analyzer by manually changing content of `.editorconfig` file
```editorconfig
[*.cs]# CA1012: Abstract types should not have public constructors
dotnet_diagnostic.CA1012.severity = error
```