├── .devcontainer
└── devcontainer.json
├── .github
├── FUNDING.yml
└── workflows
│ └── ci.yml
├── .gitignore
├── CODEOWNERS
├── LICENSE.txt
├── Meziantou.DotNet.CodingStandard.nuspec
├── Meziantou.DotNet.CodingStandard.sln
├── README.md
├── generate-editorconfigs.ps1
├── global.json
├── icon.png
├── renovate.json
├── src
├── build
│ ├── Meziantou.DotNet.CodingStandard.props
│ ├── Meziantou.DotNet.CodingStandard.targets
│ ├── ReproducibleBuilds.props
│ └── ReproducibleBuilds.targets
├── buildMultiTargeting
│ ├── Meziantou.DotNet.CodingStandard.props
│ └── Meziantou.DotNet.CodingStandard.targets
├── buildTransitive
│ ├── Meziantou.DotNet.CodingStandard.props
│ └── Meziantou.DotNet.CodingStandard.targets
└── configuration
│ ├── Analyzer.Devlooped.SponsorLink.editorconfig
│ ├── Analyzer.Meziantou.Analyzer.editorconfig
│ ├── Analyzer.Microsoft.CodeAnalysis.BannedApiAnalyzers.editorconfig
│ ├── Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig
│ ├── Analyzers.editorconfig
│ ├── BannedSymbols.txt
│ ├── CodingStyle.editorconfig
│ └── NamingConvention.editorconfig
├── tests
└── Meziantou.DotNet.CodingStandard.Tests
│ ├── CodingStandardTests.cs
│ ├── Meziantou.DotNet.CodingStandard.Tests.csproj
│ ├── PackageFixture.cs
│ ├── PathHelpers.cs
│ └── SharedHttpClient.cs
└── tools
└── ConfigFilesGenerator
├── ConfigFilesGenerator.csproj
└── Program.cs
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": ".NET in Codespaces",
3 | "image": "mcr.microsoft.com/dotnet/sdk:9.0",
4 | "features": {
5 | "ghcr.io/devcontainers/features/github-cli:1": {
6 | "version": "2"
7 | },
8 | "ghcr.io/devcontainers/features/powershell:1": {
9 | "version": "latest"
10 | },
11 | "ghcr.io/devcontainers/features/common-utils:2": {}
12 | },
13 | "customizations": {
14 | "vscode": {
15 | "extensions": [
16 | "GitHub.copilot",
17 | "GitHub.vscode-github-actions",
18 | "ms-dotnettools.vscode-dotnet-runtime",
19 | "ms-dotnettools.csdevkit",
20 | "ms-dotnetools.csharp"
21 | ]
22 | }
23 | },
24 | "hostRequirements": {
25 | "memory": "8gb",
26 | "cpus": 2
27 | },
28 | "remoteEnv": {
29 | "DOTNET_MULTILEVEL_LOOKUP": "0",
30 | "TARGET": "net8.0"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [meziantou]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: ['https://www.buymeacoffee.com/meziantou']
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: publish
2 | on:
3 | push:
4 | branches:
5 | - "main"
6 | pull_request:
7 | branches:
8 | - "*"
9 |
10 | concurrency:
11 | group: ci-site-${{ github.ref }}
12 | cancel-in-progress: false
13 |
14 | env:
15 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
16 | DOTNET_NOLOGO: true
17 | NuGetDirectory: ${{ github.workspace}}/nuget
18 |
19 | defaults:
20 | run:
21 | shell: pwsh
22 |
23 | jobs:
24 | lint_config:
25 | runs-on: windows-latest
26 | steps:
27 | - uses: actions/checkout@v4
28 | - uses: actions/setup-dotnet@v4
29 | - run: dotnet run --project=tools/ConfigFilesGenerator/ConfigFilesGenerator.csproj
30 |
31 | create_nuget:
32 | runs-on: windows-latest
33 | steps:
34 | - uses: actions/checkout@v4
35 | - uses: actions/setup-dotnet@v4
36 | - run: |
37 | try
38 | {
39 | $(Invoke-WebRequest "https://www.nuget.org/api/v2/package/Meziantou.DotNet.CodingStandard/").BaseResponse.RequestMessage.RequestUri -match "meziantou\.dotnet\.codingstandard\.1\.0\.([0-9]+).nupkg"
40 | $NewVersion = "1.0.$([int]$Matches.1 + 1)"
41 | }
42 | catch
43 | {
44 | $NewVersion = "1.0.0"
45 | }
46 |
47 | Write-Host "New version: $NewVersion"
48 | "package_version=$NewVersion" >> $env:GITHUB_OUTPUT
49 | name: Compute version
50 | id: compute-version
51 |
52 | - run: nuget pack Meziantou.DotNet.CodingStandard.nuspec -ForceEnglishOutput -Version ${{ steps.compute-version.outputs.package_version }} -Properties "RepositoryCommit=${{ github.sha }};RepositoryBranch=${{ github.ref_name }};RepositoryUrl=${{ github.repositoryUrl }}"
53 | - uses: actions/upload-artifact@v4
54 | with:
55 | name: nuget
56 | if-no-files-found: error
57 | retention-days: 3
58 | path: "**/*.nupkg"
59 |
60 | test:
61 | runs-on: ubuntu-latest
62 | needs: [create_nuget]
63 | steps:
64 | - uses: actions/checkout@v4
65 | - uses: actions/download-artifact@v4
66 | with:
67 | name: nuget
68 | path: ${{ env.NuGetDirectory }}
69 | - uses: actions/setup-dotnet@v4
70 | - run: dotnet --info
71 | - run: dotnet test tests/Meziantou.DotNet.CodingStandard.Tests/Meziantou.DotNet.CodingStandard.Tests.csproj --logger "trx;LogFileName=test_results.trx" --results-directory test_results
72 | - uses: actions/upload-artifact@v4
73 | if: always()
74 | with:
75 | name: test_results
76 | path: test_results
77 |
78 | deploy:
79 | runs-on: "ubuntu-latest"
80 | needs: [create_nuget, lint_config, test]
81 | steps:
82 | - uses: actions/checkout@v4
83 | - uses: actions/download-artifact@v4
84 | with:
85 | name: nuget
86 | path: ${{ env.NuGetDirectory }}
87 | - uses: actions/setup-dotnet@v4
88 | - run: |
89 | Write-Host "Current ref: $env:GITHUB_REF"
90 | Write-Host "Searching nupkg in folder: ${{ env.NuGetDirectory }}"
91 | $files = Get-ChildItem "${{ env.NuGetDirectory }}/*" -Recurse -Include *.nupkg
92 | foreach($file in $files) {
93 | Write-Host "Pushing NuGet package: $($file.FullName)"
94 | if ($env:GITHUB_REF -eq 'refs/heads/main')
95 | {
96 | & dotnet nuget push "$($file.FullName)" --api-key "$env:NuGetApiKey" --source https://api.nuget.org/v3/index.json --force-english-output --skip-duplicate
97 | }
98 | else
99 | {
100 | & dotnet nuget push "$($file.FullName)" --api-key "$env:FeedzApiKey" --source https://f.feedz.io/meziantou/meziantou-dotnet-codingstandard/nuget/index.json --force-english-output --skip-duplicate
101 | }
102 | }
103 | name: Publish NuGet packages
104 | if: always()
105 | env:
106 | NuGetApiKey: ${{ secrets.NuGetApiKey }}
107 | FeedzApiKey: ${{ secrets.FEEDZ_APIKEY }}
108 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @meziantou
2 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Gérald Barré
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Meziantou.DotNet.CodingStandard.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Meziantou.DotNet.CodingStandard
5 | $version$
6 | meziantou
7 | true
8 | LICENSE.txt
9 | README.md
10 | icon.png
11 | https://github.com/meziantou/Meziantou.DotNet.CodingStandard
12 | A package to configure .NET coding style and static analysis
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Meziantou.DotNet.CodingStandard.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.10.34607.79
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{40264370-1351-46DE-81E5-E4E9A73B1F31}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigFilesGenerator", "tools\ConfigFilesGenerator\ConfigFilesGenerator.csproj", "{ABCF6056-7365-4DA8-B6E0-5185A549F0C2}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E5E59418-B285-47BB-BD39-F677903D6AA7}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meziantou.DotNet.CodingStandard.Tests", "tests\Meziantou.DotNet.CodingStandard.Tests\Meziantou.DotNet.CodingStandard.Tests.csproj", "{673C0B20-EF62-40FB-808C-8822F14D9936}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionProperties) = preSolution
16 | HideSolutionNode = FALSE
17 | EndGlobalSection
18 | GlobalSection(ExtensibilityGlobals) = postSolution
19 | SolutionGuid = {CAD2B7E6-7025-4D28-9B35-6C42B60C98ED}
20 | EndGlobalSection
21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
22 | Debug|Any CPU = Debug|Any CPU
23 | Debug|x64 = Debug|x64
24 | Debug|x86 = Debug|x86
25 | Release|Any CPU = Release|Any CPU
26 | Release|x64 = Release|x64
27 | Release|x86 = Release|x86
28 | EndGlobalSection
29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
30 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Debug|x64.ActiveCfg = Debug|Any CPU
33 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Debug|x64.Build.0 = Debug|Any CPU
34 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Debug|x86.ActiveCfg = Debug|Any CPU
35 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Debug|x86.Build.0 = Debug|Any CPU
36 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Release|x64.ActiveCfg = Release|Any CPU
39 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Release|x64.Build.0 = Release|Any CPU
40 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Release|x86.ActiveCfg = Release|Any CPU
41 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2}.Release|x86.Build.0 = Release|Any CPU
42 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Debug|x64.ActiveCfg = Debug|Any CPU
45 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Debug|x64.Build.0 = Debug|Any CPU
46 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Debug|x86.ActiveCfg = Debug|Any CPU
47 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Debug|x86.Build.0 = Debug|Any CPU
48 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Release|Any CPU.Build.0 = Release|Any CPU
50 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Release|x64.ActiveCfg = Release|Any CPU
51 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Release|x64.Build.0 = Release|Any CPU
52 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Release|x86.ActiveCfg = Release|Any CPU
53 | {673C0B20-EF62-40FB-808C-8822F14D9936}.Release|x86.Build.0 = Release|Any CPU
54 | EndGlobalSection
55 | GlobalSection(NestedProjects) = preSolution
56 | {ABCF6056-7365-4DA8-B6E0-5185A549F0C2} = {40264370-1351-46DE-81E5-E4E9A73B1F31}
57 | {673C0B20-EF62-40FB-808C-8822F14D9936} = {E5E59418-B285-47BB-BD39-F677903D6AA7}
58 | EndGlobalSection
59 | EndGlobal
60 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Meziantou.DotNet.CodingStandard
2 |
3 | [](https://www.nuget.org/packages/Meziantou.DotNet.CodingStandard/)
4 |
5 | A package to configure .NET coding style and static analysis.
6 |
7 | More info at: https://www.meziantou.net/sharing-coding-style-and-roslyn-analyzers-across-projects.htm
8 |
--------------------------------------------------------------------------------
/generate-editorconfigs.ps1:
--------------------------------------------------------------------------------
1 | $env:PATH="$HOME/.dotnet/tools:$env:PATH"
2 | & dotnet tool update --global --no-cache depsupdater
3 | & depsupdater update --directory $PSScriptRoot
4 |
5 | dotnet run --project $PSScriptRoot/tools/ConfigFilesGenerator/ConfigFilesGenerator.csproj
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "rollForward": "major",
4 | "version": "9.0.100"
5 | }
6 | }
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/meziantou/Meziantou.DotNet.CodingStandard/b1b2c0192463813acb8ac62afc7762a45e453f1b/icon.png
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": [
4 | "github>meziantou/renovate-config",
5 | ":automergeAll"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/src/build/Meziantou.DotNet.CodingStandard.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 | true
6 | strict
7 | true
8 | true
9 | latest-all
10 | $(NoWarn);CA1014
11 | true
12 | latest
13 |
14 | true
15 | true
16 | true
17 |
18 |
19 |
20 | true
21 | all
22 | low
23 | (WarningsAsErrors);NU1900;NU1901;NU1902;NU1903;NU1904
24 |
25 |
26 |
27 | true
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/build/Meziantou.DotNet.CodingStandard.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/build/ReproducibleBuilds.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | embedded
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | true
15 |
16 |
17 | true
18 |
19 |
20 | true
21 |
22 |
23 | true
24 |
25 |
26 | true
27 |
28 |
29 | true
30 |
31 |
32 | true
33 |
34 |
35 | true
36 |
37 |
38 | true
39 |
40 |
41 | true
42 |
43 |
44 | true
45 |
46 |
47 | true
48 |
49 |
--------------------------------------------------------------------------------
/src/build/ReproducibleBuilds.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 | true
8 |
9 |
12 | true
13 |
14 |
15 |
16 | <_ReproducibleBuildsMSBuildMinVersion>16.10.0
17 |
18 |
19 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/buildMultiTargeting/Meziantou.DotNet.CodingStandard.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/buildMultiTargeting/Meziantou.DotNet.CodingStandard.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/buildTransitive/Meziantou.DotNet.CodingStandard.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/buildTransitive/Meziantou.DotNet.CodingStandard.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/configuration/Analyzer.Devlooped.SponsorLink.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | global_level = 0
3 |
4 | dotnet_diagnostic.DSL001.severity = none
5 | dotnet_diagnostic.DSL002.severity = none
6 |
7 | dotnet_diagnostic.MOQ100.severity = none
8 | dotnet_diagnostic.MOQ101.severity = none
9 | dotnet_diagnostic.MOQ102.severity = none
10 |
--------------------------------------------------------------------------------
/src/configuration/Analyzer.Meziantou.Analyzer.editorconfig:
--------------------------------------------------------------------------------
1 | # global_level must be higher than the NET Analyzer files
2 | is_global = true
3 | global_level = 0
4 |
5 | # MA0001: StringComparison is missing
6 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0001.md
7 | # Enabled: True, Severity: suggestion
8 | dotnet_diagnostic.MA0001.severity = warning
9 |
10 | # MA0002: IEqualityComparer or IComparer is missing
11 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md
12 | # Enabled: True, Severity: warning
13 | dotnet_diagnostic.MA0002.severity = warning
14 |
15 | # MA0003: Add parameter name to improve readability
16 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0003.md
17 | # Enabled: True, Severity: suggestion
18 | dotnet_diagnostic.MA0003.severity = suggestion
19 |
20 | # MA0004: Use Task.ConfigureAwait
21 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0004.md
22 | # Enabled: True, Severity: warning
23 | dotnet_diagnostic.MA0004.severity = warning
24 |
25 | # MA0005: Use Array.Empty()
26 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0005.md
27 | # Enabled: True, Severity: warning
28 | # Superseeded by CA1825
29 | dotnet_diagnostic.MA0005.severity = none
30 |
31 | # MA0006: Use String.Equals instead of equality operator
32 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0006.md
33 | # Enabled: True, Severity: warning
34 | dotnet_diagnostic.MA0006.severity = silent
35 |
36 | # MA0007: Add a comma after the last value
37 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0007.md
38 | # Enabled: True, Severity: suggestion
39 | dotnet_diagnostic.MA0007.severity = suggestion
40 |
41 | # MA0008: Add StructLayoutAttribute
42 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0008.md
43 | # Enabled: True, Severity: warning
44 | dotnet_diagnostic.MA0008.severity = warning
45 |
46 | # MA0009: Add regex evaluation timeout
47 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0009.md
48 | # Enabled: True, Severity: warning
49 | dotnet_diagnostic.MA0009.severity = warning
50 |
51 | # MA0010: Mark attributes with AttributeUsageAttribute
52 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0010.md
53 | # Enabled: True, Severity: warning
54 | # Superseeded by CA1018
55 | dotnet_diagnostic.MA0010.severity = none
56 |
57 | # MA0011: IFormatProvider is missing
58 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0011.md
59 | # Enabled: True, Severity: warning
60 | dotnet_diagnostic.MA0011.severity = warning
61 |
62 | # MA0012: Do not raise reserved exception type
63 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0012.md
64 | # Enabled: True, Severity: warning
65 | dotnet_diagnostic.MA0012.severity = warning
66 |
67 | # MA0013: Types should not extend System.ApplicationException
68 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0013.md
69 | # Enabled: True, Severity: warning
70 | dotnet_diagnostic.MA0013.severity = warning
71 |
72 | # MA0014: Do not raise System.ApplicationException type
73 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0014.md
74 | # Enabled: True, Severity: warning
75 | dotnet_diagnostic.MA0014.severity = warning
76 |
77 | # MA0015: Specify the parameter name in ArgumentException
78 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0015.md
79 | # Enabled: True, Severity: warning
80 | dotnet_diagnostic.MA0015.severity = warning
81 |
82 | # MA0016: Prefer using collection abstraction instead of implementation
83 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0016.md
84 | # Enabled: True, Severity: warning
85 | dotnet_diagnostic.MA0016.severity = none
86 |
87 | # MA0017: Abstract types should not have public or internal constructors
88 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0017.md
89 | # Enabled: True, Severity: warning
90 | dotnet_diagnostic.MA0017.severity = warning
91 |
92 | # MA0018: Do not declare static members on generic types (deprecated; use CA1000 instead)
93 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0018.md
94 | # Enabled: True, Severity: suggestion
95 | # Superseeded by CA1000
96 | dotnet_diagnostic.MA0018.severity = none
97 |
98 | # MA0019: Use EventArgs.Empty
99 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0019.md
100 | # Enabled: True, Severity: warning
101 | dotnet_diagnostic.MA0019.severity = warning
102 |
103 | # MA0020: Use direct methods instead of LINQ methods
104 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0020.md
105 | # Enabled: True, Severity: suggestion
106 | dotnet_diagnostic.MA0020.severity = suggestion
107 |
108 | # MA0021: Use StringComparer.GetHashCode instead of string.GetHashCode
109 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0021.md
110 | # Enabled: True, Severity: warning
111 | dotnet_diagnostic.MA0021.severity = warning
112 |
113 | # MA0022: Return Task.FromResult instead of returning null
114 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0022.md
115 | # Enabled: True, Severity: warning
116 | dotnet_diagnostic.MA0022.severity = warning
117 |
118 | # MA0023: Add RegexOptions.ExplicitCapture
119 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0023.md
120 | # Enabled: True, Severity: warning
121 | dotnet_diagnostic.MA0023.severity = warning
122 |
123 | # MA0024: Use an explicit StringComparer when possible
124 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0024.md
125 | # Enabled: True, Severity: warning
126 | dotnet_diagnostic.MA0024.severity = warning
127 |
128 | # MA0025: Implement the functionality instead of throwing NotImplementedException
129 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0025.md
130 | # Enabled: True, Severity: warning
131 | dotnet_diagnostic.MA0025.severity = warning
132 |
133 | # MA0026: Fix TODO comment
134 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0026.md
135 | # Enabled: True, Severity: warning
136 | dotnet_diagnostic.MA0026.severity = warning
137 |
138 | # MA0027: Prefer rethrowing an exception implicitly
139 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0027.md
140 | # Enabled: True, Severity: warning
141 | dotnet_diagnostic.MA0027.severity = warning
142 |
143 | # MA0028: Optimize StringBuilder usage
144 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0028.md
145 | # Enabled: True, Severity: suggestion
146 | dotnet_diagnostic.MA0028.severity = suggestion
147 |
148 | # MA0029: Combine LINQ methods
149 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0029.md
150 | # Enabled: True, Severity: suggestion
151 | dotnet_diagnostic.MA0029.severity = suggestion
152 |
153 | # MA0030: Remove useless OrderBy call
154 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0030.md
155 | # Enabled: True, Severity: warning
156 | dotnet_diagnostic.MA0030.severity = warning
157 |
158 | # MA0031: Optimize Enumerable.Count() usage
159 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0031.md
160 | # Enabled: True, Severity: suggestion
161 | dotnet_diagnostic.MA0031.severity = suggestion
162 |
163 | # MA0032: Use an overload with a CancellationToken argument
164 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0032.md
165 | # Enabled: False, Severity: suggestion
166 | dotnet_diagnostic.MA0032.severity = none
167 |
168 | # MA0033: Do not tag instance fields with ThreadStaticAttribute
169 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0033.md
170 | # Enabled: True, Severity: warning
171 | dotnet_diagnostic.MA0033.severity = warning
172 |
173 | # MA0035: Do not use dangerous threading methods
174 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0035.md
175 | # Enabled: True, Severity: warning
176 | dotnet_diagnostic.MA0035.severity = warning
177 |
178 | # MA0036: Make class static
179 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0036.md
180 | # Enabled: True, Severity: suggestion
181 | dotnet_diagnostic.MA0036.severity = suggestion
182 |
183 | # MA0037: Remove empty statement
184 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0037.md
185 | # Enabled: True, Severity: error
186 | dotnet_diagnostic.MA0037.severity = error
187 |
188 | # MA0038: Make method static (deprecated, use CA1822 instead)
189 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0038.md
190 | # Enabled: True, Severity: suggestion
191 | dotnet_diagnostic.MA0038.severity = none
192 |
193 | # MA0039: Do not write your own certificate validation method
194 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0039.md
195 | # Enabled: True, Severity: error
196 | dotnet_diagnostic.MA0039.severity = error
197 |
198 | # MA0040: Forward the CancellationToken parameter to methods that take one
199 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0040.md
200 | # Enabled: True, Severity: suggestion
201 | dotnet_diagnostic.MA0040.severity = suggestion
202 |
203 | # MA0041: Make property static (deprecated, use CA1822 instead)
204 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0041.md
205 | # Enabled: True, Severity: suggestion
206 | dotnet_diagnostic.MA0041.severity = none
207 |
208 | # MA0042: Do not use blocking calls in an async method
209 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0042.md
210 | # Enabled: True, Severity: suggestion
211 | dotnet_diagnostic.MA0042.severity = suggestion
212 |
213 | # MA0043: Use nameof operator in ArgumentException
214 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0043.md
215 | # Enabled: True, Severity: suggestion
216 | dotnet_diagnostic.MA0043.severity = suggestion
217 |
218 | # MA0044: Remove useless ToString call
219 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0044.md
220 | # Enabled: True, Severity: suggestion
221 | dotnet_diagnostic.MA0044.severity = suggestion
222 |
223 | # MA0045: Do not use blocking calls in a sync method (need to make calling method async)
224 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0045.md
225 | # Enabled: False, Severity: suggestion
226 | dotnet_diagnostic.MA0045.severity = none
227 |
228 | # MA0046: Use EventHandler to declare events
229 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0046.md
230 | # Enabled: True, Severity: warning
231 | dotnet_diagnostic.MA0046.severity = warning
232 |
233 | # MA0047: Declare types in namespaces
234 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0047.md
235 | # Enabled: True, Severity: warning
236 | dotnet_diagnostic.MA0047.severity = warning
237 |
238 | # MA0048: File name must match type name
239 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0048.md
240 | # Enabled: True, Severity: warning
241 | dotnet_diagnostic.MA0048.severity = warning
242 |
243 | # MA0049: Type name should not match containing namespace
244 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0049.md
245 | # Enabled: True, Severity: error
246 | dotnet_diagnostic.MA0049.severity = error
247 |
248 | # MA0050: Validate arguments correctly in iterator methods
249 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0050.md
250 | # Enabled: True, Severity: suggestion
251 | dotnet_diagnostic.MA0050.severity = suggestion
252 |
253 | # MA0051: Method is too long
254 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0051.md
255 | # Enabled: True, Severity: warning
256 | dotnet_diagnostic.MA0051.severity = none
257 |
258 | # MA0052: Replace constant Enum.ToString with nameof
259 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0052.md
260 | # Enabled: True, Severity: suggestion
261 | dotnet_diagnostic.MA0052.severity = suggestion
262 |
263 | # MA0053: Make class sealed
264 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0053.md
265 | # Enabled: True, Severity: suggestion
266 | dotnet_diagnostic.MA0053.severity = suggestion
267 |
268 | # MA0054: Embed the caught exception as innerException
269 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0054.md
270 | # Enabled: True, Severity: warning
271 | dotnet_diagnostic.MA0054.severity = warning
272 |
273 | # MA0055: Do not use finalizer
274 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0055.md
275 | # Enabled: True, Severity: warning
276 | dotnet_diagnostic.MA0055.severity = warning
277 |
278 | # MA0056: Do not call overridable members in constructor
279 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0056.md
280 | # Enabled: True, Severity: warning
281 | dotnet_diagnostic.MA0056.severity = warning
282 |
283 | # MA0057: Class name should end with 'Attribute'
284 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0057.md
285 | # Enabled: True, Severity: suggestion
286 | dotnet_diagnostic.MA0057.severity = suggestion
287 |
288 | # MA0058: Class name should end with 'Exception'
289 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0058.md
290 | # Enabled: True, Severity: suggestion
291 | dotnet_diagnostic.MA0058.severity = suggestion
292 |
293 | # MA0059: Class name should end with 'EventArgs'
294 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0059.md
295 | # Enabled: True, Severity: suggestion
296 | dotnet_diagnostic.MA0059.severity = suggestion
297 |
298 | # MA0060: The value returned by Stream.Read/Stream.ReadAsync is not used
299 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0060.md
300 | # Enabled: True, Severity: warning
301 | dotnet_diagnostic.MA0060.severity = warning
302 |
303 | # MA0061: Method overrides should not change default values
304 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0061.md
305 | # Enabled: True, Severity: warning
306 | dotnet_diagnostic.MA0061.severity = warning
307 |
308 | # MA0062: Non-flags enums should not be marked with "FlagsAttribute"
309 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0062.md
310 | # Enabled: True, Severity: warning
311 | # Superseeded by CA2217
312 | dotnet_diagnostic.MA0062.severity = none
313 |
314 | # MA0063: Use Where before OrderBy
315 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0063.md
316 | # Enabled: True, Severity: suggestion
317 | dotnet_diagnostic.MA0063.severity = suggestion
318 |
319 | # MA0064: Avoid locking on publicly accessible instance
320 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0064.md
321 | # Enabled: True, Severity: warning
322 | dotnet_diagnostic.MA0064.severity = warning
323 |
324 | # MA0065: Default ValueType.Equals or HashCode is used for struct equality
325 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0065.md
326 | # Enabled: True, Severity: warning
327 | dotnet_diagnostic.MA0065.severity = warning
328 |
329 | # MA0066: Hash table unfriendly type is used in a hash table
330 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0066.md
331 | # Enabled: True, Severity: warning
332 | dotnet_diagnostic.MA0066.severity = warning
333 |
334 | # MA0067: Use Guid.Empty
335 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0067.md
336 | # Enabled: True, Severity: suggestion
337 | dotnet_diagnostic.MA0067.severity = suggestion
338 |
339 | # MA0068: Invalid parameter name for nullable attribute
340 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0068.md
341 | # Enabled: True, Severity: warning
342 | dotnet_diagnostic.MA0068.severity = warning
343 |
344 | # MA0069: Non-constant static fields should not be visible
345 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0069.md
346 | # Enabled: True, Severity: warning
347 | dotnet_diagnostic.MA0069.severity = warning
348 |
349 | # MA0070: Obsolete attributes should include explanations
350 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0070.md
351 | # Enabled: True, Severity: warning
352 | dotnet_diagnostic.MA0070.severity = warning
353 |
354 | # MA0071: Avoid using redundant else
355 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0071.md
356 | # Enabled: True, Severity: suggestion
357 | dotnet_diagnostic.MA0071.severity = silent
358 |
359 | # MA0072: Do not throw from a finally block
360 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0072.md
361 | # Enabled: True, Severity: warning
362 | dotnet_diagnostic.MA0072.severity = warning
363 |
364 | # MA0073: Avoid comparison with bool constant
365 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0073.md
366 | # Enabled: True, Severity: suggestion
367 | dotnet_diagnostic.MA0073.severity = suggestion
368 |
369 | # MA0074: Avoid implicit culture-sensitive methods
370 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0074.md
371 | # Enabled: True, Severity: warning
372 | dotnet_diagnostic.MA0074.severity = warning
373 |
374 | # MA0075: Do not use implicit culture-sensitive ToString
375 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0075.md
376 | # Enabled: True, Severity: suggestion
377 | dotnet_diagnostic.MA0075.severity = suggestion
378 |
379 | # MA0076: Do not use implicit culture-sensitive ToString in interpolated strings
380 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0076.md
381 | # Enabled: True, Severity: suggestion
382 | dotnet_diagnostic.MA0076.severity = suggestion
383 |
384 | # MA0077: A class that provides Equals(T) should implement IEquatable
385 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0077.md
386 | # Enabled: True, Severity: warning
387 | dotnet_diagnostic.MA0077.severity = warning
388 |
389 | # MA0078: Use 'Cast' instead of 'Select' to cast
390 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0078.md
391 | # Enabled: True, Severity: suggestion
392 | dotnet_diagnostic.MA0078.severity = none
393 |
394 | # MA0079: Forward the CancellationToken using .WithCancellation()
395 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0079.md
396 | # Enabled: True, Severity: suggestion
397 | dotnet_diagnostic.MA0079.severity = suggestion
398 |
399 | # MA0080: Use a cancellation token using .WithCancellation()
400 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0080.md
401 | # Enabled: False, Severity: suggestion
402 | dotnet_diagnostic.MA0080.severity = none
403 |
404 | # MA0081: Method overrides should not omit params keyword
405 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0081.md
406 | # Enabled: True, Severity: warning
407 | dotnet_diagnostic.MA0081.severity = warning
408 |
409 | # MA0082: NaN should not be used in comparisons
410 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0082.md
411 | # Enabled: True, Severity: warning
412 | dotnet_diagnostic.MA0082.severity = warning
413 |
414 | # MA0083: ConstructorArgument parameters should exist in constructors
415 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0083.md
416 | # Enabled: True, Severity: warning
417 | dotnet_diagnostic.MA0083.severity = warning
418 |
419 | # MA0084: Local variables should not hide other symbols
420 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0084.md
421 | # Enabled: True, Severity: warning
422 | dotnet_diagnostic.MA0084.severity = warning
423 |
424 | # MA0085: Anonymous delegates should not be used to unsubscribe from Events
425 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0085.md
426 | # Enabled: True, Severity: warning
427 | dotnet_diagnostic.MA0085.severity = warning
428 |
429 | # MA0086: Do not throw from a finalizer
430 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0086.md
431 | # Enabled: True, Severity: warning
432 | dotnet_diagnostic.MA0086.severity = warning
433 |
434 | # MA0087: Parameters with [DefaultParameterValue] attributes should also be marked [Optional]
435 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0087.md
436 | # Enabled: True, Severity: warning
437 | dotnet_diagnostic.MA0087.severity = warning
438 |
439 | # MA0088: Use [DefaultParameterValue] instead of [DefaultValue]
440 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0088.md
441 | # Enabled: True, Severity: warning
442 | dotnet_diagnostic.MA0088.severity = warning
443 |
444 | # MA0089: Optimize string method usage
445 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0089.md
446 | # Enabled: True, Severity: suggestion
447 | dotnet_diagnostic.MA0089.severity = suggestion
448 |
449 | # MA0090: Remove empty else/finally block
450 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0090.md
451 | # Enabled: True, Severity: suggestion
452 | dotnet_diagnostic.MA0090.severity = suggestion
453 |
454 | # MA0091: Sender should be 'this' for instance events
455 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0091.md
456 | # Enabled: True, Severity: warning
457 | dotnet_diagnostic.MA0091.severity = warning
458 |
459 | # MA0092: Sender should be 'null' for static events
460 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0092.md
461 | # Enabled: True, Severity: warning
462 | dotnet_diagnostic.MA0092.severity = warning
463 |
464 | # MA0093: EventArgs should not be null
465 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0093.md
466 | # Enabled: True, Severity: warning
467 | dotnet_diagnostic.MA0093.severity = warning
468 |
469 | # MA0094: A class that provides CompareTo(T) should implement IComparable
470 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0094.md
471 | # Enabled: True, Severity: warning
472 | dotnet_diagnostic.MA0094.severity = warning
473 |
474 | # MA0095: A class that implements IEquatable should override Equals(object)
475 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0095.md
476 | # Enabled: True, Severity: warning
477 | dotnet_diagnostic.MA0095.severity = warning
478 |
479 | # MA0096: A class that implements IComparable should also implement IEquatable
480 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0096.md
481 | # Enabled: True, Severity: warning
482 | dotnet_diagnostic.MA0096.severity = warning
483 |
484 | # MA0097: A class that implements IComparable or IComparable should override comparison operators
485 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0097.md
486 | # Enabled: True, Severity: warning
487 | dotnet_diagnostic.MA0097.severity = warning
488 |
489 | # MA0098: Use indexer instead of LINQ methods
490 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0098.md
491 | # Enabled: True, Severity: suggestion
492 | dotnet_diagnostic.MA0098.severity = suggestion
493 |
494 | # MA0099: Use Explicit enum value instead of 0
495 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0099.md
496 | # Enabled: True, Severity: warning
497 | dotnet_diagnostic.MA0099.severity = warning
498 |
499 | # MA0100: Await task before disposing of resources
500 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0100.md
501 | # Enabled: True, Severity: warning
502 | dotnet_diagnostic.MA0100.severity = warning
503 |
504 | # MA0101: String contains an implicit end of line character
505 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0101.md
506 | # Enabled: True, Severity: silent
507 | dotnet_diagnostic.MA0101.severity = silent
508 |
509 | # MA0102: Make member readonly
510 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0102.md
511 | # Enabled: True, Severity: suggestion
512 | dotnet_diagnostic.MA0102.severity = suggestion
513 |
514 | # MA0103: Use SequenceEqual instead of equality operator
515 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0103.md
516 | # Enabled: True, Severity: warning
517 | dotnet_diagnostic.MA0103.severity = warning
518 |
519 | # MA0104: Do not create a type with a name from the BCL
520 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0104.md
521 | # Enabled: False, Severity: warning
522 | dotnet_diagnostic.MA0104.severity = none
523 |
524 | # MA0105: Use the lambda parameters instead of using a closure
525 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0105.md
526 | # Enabled: True, Severity: suggestion
527 | dotnet_diagnostic.MA0105.severity = suggestion
528 |
529 | # MA0106: Avoid closure by using an overload with the 'factoryArgument' parameter
530 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0106.md
531 | # Enabled: True, Severity: suggestion
532 | dotnet_diagnostic.MA0106.severity = suggestion
533 |
534 | # MA0107: Do not use culture-sensitive object.ToString
535 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0107.md
536 | # Enabled: False, Severity: suggestion
537 | dotnet_diagnostic.MA0107.severity = none
538 |
539 | # MA0108: Remove redundant argument value
540 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0108.md
541 | # Enabled: True, Severity: suggestion
542 | dotnet_diagnostic.MA0108.severity = suggestion
543 |
544 | # MA0109: Consider adding an overload with a Span or Memory
545 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0109.md
546 | # Enabled: False, Severity: suggestion
547 | dotnet_diagnostic.MA0109.severity = none
548 |
549 | # MA0110: Use the Regex source generator
550 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0110.md
551 | # Enabled: True, Severity: suggestion
552 | dotnet_diagnostic.MA0110.severity = suggestion
553 |
554 | # MA0111: Use string.Create instead of FormattableString
555 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0111.md
556 | # Enabled: True, Severity: suggestion
557 | dotnet_diagnostic.MA0111.severity = suggestion
558 |
559 | # MA0112: Use 'Count > 0' instead of 'Any()'
560 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0112.md
561 | # Enabled: False, Severity: suggestion
562 | dotnet_diagnostic.MA0112.severity = silent
563 |
564 | # MA0113: Use DateTime.UnixEpoch
565 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0113.md
566 | # Enabled: True, Severity: suggestion
567 | dotnet_diagnostic.MA0113.severity = suggestion
568 |
569 | # MA0114: Use DateTimeOffset.UnixEpoch
570 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0114.md
571 | # Enabled: True, Severity: suggestion
572 | dotnet_diagnostic.MA0114.severity = suggestion
573 |
574 | # MA0115: Unknown component parameter
575 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0115.md
576 | # Enabled: True, Severity: warning
577 | dotnet_diagnostic.MA0115.severity = warning
578 |
579 | # MA0116: Parameters with [SupplyParameterFromQuery] attributes should also be marked as [Parameter]
580 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0116.md
581 | # Enabled: True, Severity: warning
582 | dotnet_diagnostic.MA0116.severity = warning
583 |
584 | # MA0117: Parameters with [EditorRequired] attributes should also be marked as [Parameter]
585 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0117.md
586 | # Enabled: True, Severity: warning
587 | dotnet_diagnostic.MA0117.severity = warning
588 |
589 | # MA0118: [JSInvokable] methods must be public
590 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0118.md
591 | # Enabled: True, Severity: warning
592 | dotnet_diagnostic.MA0118.severity = warning
593 |
594 | # MA0119: JSRuntime must not be used in OnInitialized or OnInitializedAsync
595 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0119.md
596 | # Enabled: True, Severity: warning
597 | dotnet_diagnostic.MA0119.severity = warning
598 |
599 | # MA0120: Use InvokeVoidAsync when the returned value is not used
600 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0120.md
601 | # Enabled: True, Severity: suggestion
602 | dotnet_diagnostic.MA0120.severity = warning
603 |
604 | # MA0121: Do not overwrite parameter value
605 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0121.md
606 | # Enabled: False, Severity: suggestion
607 | dotnet_diagnostic.MA0121.severity = none
608 |
609 | # MA0122: Parameters with [SupplyParameterFromQuery] attributes are only valid in routable components (@page)
610 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0122.md
611 | # Enabled: True, Severity: suggestion
612 | dotnet_diagnostic.MA0122.severity = warning
613 |
614 | # MA0123: Sequence number must be a constant
615 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0123.md
616 | # Enabled: True, Severity: warning
617 | dotnet_diagnostic.MA0123.severity = warning
618 |
619 | # MA0124: Log parameter type is not valid
620 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0124.md
621 | # Enabled: True, Severity: warning
622 | dotnet_diagnostic.MA0124.severity = warning
623 |
624 | # MA0125: The list of log parameter types contains an invalid type
625 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0125.md
626 | # Enabled: True, Severity: warning
627 | dotnet_diagnostic.MA0125.severity = warning
628 |
629 | # MA0126: The list of log parameter types contains a duplicate
630 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0126.md
631 | # Enabled: True, Severity: warning
632 | dotnet_diagnostic.MA0126.severity = warning
633 |
634 | # MA0127: Use String.Equals instead of is pattern
635 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0127.md
636 | # Enabled: False, Severity: warning
637 | dotnet_diagnostic.MA0127.severity = none
638 |
639 | # MA0128: Use 'is' operator instead of SequenceEqual
640 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0128.md
641 | # Enabled: True, Severity: suggestion
642 | dotnet_diagnostic.MA0128.severity = suggestion
643 |
644 | # MA0129: Await task in using statement
645 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0129.md
646 | # Enabled: True, Severity: warning
647 | dotnet_diagnostic.MA0129.severity = warning
648 |
649 | # MA0130: GetType() should not be used on System.Type instances
650 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0130.md
651 | # Enabled: True, Severity: warning
652 | dotnet_diagnostic.MA0130.severity = warning
653 |
654 | # MA0131: ArgumentNullException.ThrowIfNull should not be used with non-nullable types
655 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0131.md
656 | # Enabled: True, Severity: warning
657 | dotnet_diagnostic.MA0131.severity = warning
658 |
659 | # MA0132: Do not convert implicitly to DateTimeOffset
660 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0132.md
661 | # Enabled: True, Severity: warning
662 | dotnet_diagnostic.MA0132.severity = warning
663 |
664 | # MA0133: Use DateTimeOffset instead of relying on the implicit conversion
665 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0133.md
666 | # Enabled: True, Severity: suggestion
667 | dotnet_diagnostic.MA0133.severity = warning
668 |
669 | # MA0134: Observe result of async calls
670 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0134.md
671 | # Enabled: True, Severity: warning
672 | dotnet_diagnostic.MA0134.severity = warning
673 |
674 | # MA0135: The log parameter has no configured type
675 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0135.md
676 | # Enabled: False, Severity: warning
677 | dotnet_diagnostic.MA0135.severity = none
678 |
679 | # MA0136: Raw String contains an implicit end of line character
680 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0136.md
681 | # Enabled: True, Severity: silent
682 | dotnet_diagnostic.MA0136.severity = silent
683 |
684 | # MA0137: Use 'Async' suffix when a method returns an awaitable type
685 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0137.md
686 | # Enabled: False, Severity: warning
687 | dotnet_diagnostic.MA0137.severity = none
688 |
689 | # MA0138: Do not use 'Async' suffix when a method does not return an awaitable type
690 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0138.md
691 | # Enabled: False, Severity: warning
692 | dotnet_diagnostic.MA0138.severity = none
693 |
694 | # MA0139: Log parameter type is not valid
695 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0139.md
696 | # Enabled: True, Severity: warning
697 | dotnet_diagnostic.MA0139.severity = warning
698 |
699 | # MA0140: Both if and else branch have identical code
700 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0140.md
701 | # Enabled: True, Severity: warning
702 | dotnet_diagnostic.MA0140.severity = warning
703 |
704 | # MA0141: Use pattern matching instead of inequality operators for null check
705 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0141.md
706 | # Enabled: False, Severity: suggestion
707 | dotnet_diagnostic.MA0141.severity = suggestion
708 |
709 | # MA0142: Use pattern matching instead of equality operators for null check
710 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0142.md
711 | # Enabled: False, Severity: suggestion
712 | dotnet_diagnostic.MA0142.severity = suggestion
713 |
714 | # MA0143: Primary constructor parameters should be readonly
715 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0143.md
716 | # Enabled: True, Severity: warning
717 | dotnet_diagnostic.MA0143.severity = warning
718 |
719 | # MA0144: Use System.OperatingSystem to check the current OS
720 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0144.md
721 | # Enabled: True, Severity: warning
722 | dotnet_diagnostic.MA0144.severity = warning
723 |
724 | # MA0145: Signature for [UnsafeAccessorAttribute] method is not valid
725 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0145.md
726 | # Enabled: True, Severity: warning
727 | dotnet_diagnostic.MA0145.severity = warning
728 |
729 | # MA0146: Name must be set explicitly on local functions
730 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0146.md
731 | # Enabled: True, Severity: warning
732 | dotnet_diagnostic.MA0146.severity = warning
733 |
734 | # MA0147: Avoid async void method for delegate
735 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0147.md
736 | # Enabled: True, Severity: warning
737 | dotnet_diagnostic.MA0147.severity = warning
738 |
739 | # MA0148: Use pattern matching instead of equality operators for discrete value
740 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0148.md
741 | # Enabled: False, Severity: suggestion
742 | dotnet_diagnostic.MA0148.severity = suggestion
743 |
744 | # MA0149: Use pattern matching instead of inequality operators for discrete value
745 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0149.md
746 | # Enabled: False, Severity: suggestion
747 | dotnet_diagnostic.MA0149.severity = suggestion
748 |
749 | # MA0150: Do not call the default object.ToString explicitly
750 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0150.md
751 | # Enabled: True, Severity: warning
752 | dotnet_diagnostic.MA0150.severity = warning
753 |
754 | # MA0151: DebuggerDisplay must contain valid members
755 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0151.md
756 | # Enabled: True, Severity: warning
757 | dotnet_diagnostic.MA0151.severity = warning
758 |
759 | # MA0152: Use Unwrap instead of using await twice
760 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0152.md
761 | # Enabled: True, Severity: suggestion
762 | dotnet_diagnostic.MA0152.severity = suggestion
763 |
764 | # MA0153: Do not log symbols decorated with DataClassificationAttribute directly
765 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0153.md
766 | # Enabled: True, Severity: warning
767 | dotnet_diagnostic.MA0153.severity = warning
768 |
769 | # MA0154: Use langword in XML comment
770 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0154.md
771 | # Enabled: True, Severity: suggestion
772 | dotnet_diagnostic.MA0154.severity = suggestion
773 |
774 | # MA0155: Do not use async void methods
775 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0155.md
776 | # Enabled: False, Severity: warning
777 | dotnet_diagnostic.MA0155.severity = warning
778 |
779 | # MA0156: Use 'Async' suffix when a method returns IAsyncEnumerable
780 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0156.md
781 | # Enabled: False, Severity: warning
782 | dotnet_diagnostic.MA0156.severity = none
783 |
784 | # MA0157: Do not use 'Async' suffix when a method returns IAsyncEnumerable
785 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0157.md
786 | # Enabled: False, Severity: warning
787 | dotnet_diagnostic.MA0157.severity = none
788 |
789 | # MA0158: Use System.Threading.Lock
790 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0158.md
791 | # Enabled: True, Severity: warning
792 | dotnet_diagnostic.MA0158.severity = warning
793 |
794 | # MA0159: Use 'Order' instead of 'OrderBy'
795 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0159.md
796 | # Enabled: True, Severity: suggestion
797 | dotnet_diagnostic.MA0159.severity = suggestion
798 |
799 | # MA0160: Use ContainsKey instead of TryGetValue
800 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0160.md
801 | # Enabled: True, Severity: suggestion
802 | dotnet_diagnostic.MA0160.severity = suggestion
803 |
804 | # MA0161: UseShellExecute must be explicitly set
805 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0161.md
806 | # Enabled: False, Severity: suggestion
807 | dotnet_diagnostic.MA0161.severity = none
808 |
809 | # MA0162: Use Process.Start overload with ProcessStartInfo
810 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0162.md
811 | # Enabled: False, Severity: suggestion
812 | dotnet_diagnostic.MA0162.severity = none
813 |
814 | # MA0163: UseShellExecute must be false when redirecting standard input or output
815 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0163.md
816 | # Enabled: True, Severity: warning
817 | dotnet_diagnostic.MA0163.severity = warning
818 |
819 | # MA0164: Use parentheses to make not pattern clearer
820 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0164.md
821 | # Enabled: True, Severity: warning
822 | dotnet_diagnostic.MA0164.severity = warning
823 |
824 | # MA0165: Make interpolated string
825 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0165.md
826 | # Enabled: True, Severity: silent
827 | dotnet_diagnostic.MA0165.severity = none
828 |
829 | # MA0166: Forward the TimeProvider to methods that take one
830 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0166.md
831 | # Enabled: True, Severity: suggestion
832 | dotnet_diagnostic.MA0166.severity = suggestion
833 |
834 | # MA0167: Use an overload with a TimeProvider argument
835 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0167.md
836 | # Enabled: False, Severity: suggestion
837 | dotnet_diagnostic.MA0167.severity = none
838 |
839 | # MA0168: Use readonly struct for in or ref readonly parameter
840 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0168.md
841 | # Enabled: False, Severity: suggestion
842 | dotnet_diagnostic.MA0168.severity = none
843 |
844 | # MA0169: Use Equals method instead of operator
845 | # Help link: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0169.md
846 | # Enabled: True, Severity: warning
847 | dotnet_diagnostic.MA0169.severity = warning
848 |
849 |
--------------------------------------------------------------------------------
/src/configuration/Analyzer.Microsoft.CodeAnalysis.BannedApiAnalyzers.editorconfig:
--------------------------------------------------------------------------------
1 | # global_level must be higher than the NET Analyzer files
2 | is_global = true
3 | global_level = 0
4 |
5 | # RS0030: Do not use banned APIs
6 | # Help link: https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md
7 | # Enabled: True, Severity: warning
8 | dotnet_diagnostic.RS0030.severity = warning
9 |
10 | # RS0031: The list of banned symbols contains a duplicate
11 | # Help link: https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md
12 | # Enabled: True, Severity: warning
13 | dotnet_diagnostic.RS0031.severity = warning
14 |
15 | # RS0035: External access to internal symbols outside the restricted namespace(s) is prohibited
16 | # Enabled: True, Severity: error
17 | dotnet_diagnostic.RS0035.severity = error
18 |
19 |
--------------------------------------------------------------------------------
/src/configuration/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig:
--------------------------------------------------------------------------------
1 | # global_level must be higher than the NET Analyzer files
2 | is_global = true
3 | global_level = 0
4 |
5 | dotnet_diagnostic.CA2217.api_surface = all
6 |
7 | # CA1000: Do not declare static members on generic types
8 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1000
9 | # Enabled: True, Severity: silent
10 | dotnet_diagnostic.CA1000.severity = warning
11 |
12 | # CA1001: Types that own disposable fields should be disposable
13 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001
14 | # Enabled: True, Severity: silent
15 | dotnet_diagnostic.CA1001.severity = warning
16 |
17 | # CA1002: Do not expose generic lists
18 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002
19 | # Enabled: False, Severity: warning
20 | dotnet_diagnostic.CA1002.severity = warning
21 |
22 | # CA1003: Use generic event handler instances
23 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1003
24 | # Enabled: False, Severity: warning
25 | dotnet_diagnostic.CA1003.severity = warning
26 |
27 | # CA1005: Avoid excessive parameters on generic types
28 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1005
29 | # Enabled: False, Severity: warning
30 | dotnet_diagnostic.CA1005.severity = warning
31 |
32 | # CA1008: Enums should have zero value
33 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1008
34 | # Enabled: False, Severity: warning
35 | dotnet_diagnostic.CA1008.severity = warning
36 |
37 | # CA1010: Generic interface should also be implemented
38 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1010
39 | # Enabled: True, Severity: silent
40 | dotnet_diagnostic.CA1010.severity = warning
41 |
42 | # CA1012: Abstract types should not have public constructors
43 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1012
44 | # Enabled: False, Severity: warning
45 | dotnet_diagnostic.CA1012.severity = warning
46 |
47 | # CA1014: Mark assemblies with CLSCompliant
48 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1014
49 | # Enabled: False, Severity: warning
50 | dotnet_diagnostic.CA1014.severity = none
51 |
52 | # CA1016: Mark assemblies with assembly version
53 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1016
54 | # Enabled: True, Severity: suggestion
55 | dotnet_diagnostic.CA1016.severity = warning
56 |
57 | # CA1017: Mark assemblies with ComVisible
58 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1017
59 | # Enabled: False, Severity: warning
60 | dotnet_diagnostic.CA1017.severity = none
61 |
62 | # CA1018: Mark attributes with AttributeUsageAttribute
63 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1018
64 | # Enabled: True, Severity: suggestion
65 | dotnet_diagnostic.CA1018.severity = warning
66 |
67 | # CA1019: Define accessors for attribute arguments
68 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1019
69 | # Enabled: False, Severity: warning
70 | dotnet_diagnostic.CA1019.severity = warning
71 |
72 | # CA1021: Avoid out parameters
73 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1021
74 | # Enabled: False, Severity: warning
75 | dotnet_diagnostic.CA1021.severity = none
76 |
77 | # CA1024: Use properties where appropriate
78 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1024
79 | # Enabled: False, Severity: warning
80 | dotnet_diagnostic.CA1024.severity = none
81 |
82 | # CA1027: Mark enums with FlagsAttribute
83 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1027
84 | # Enabled: False, Severity: warning
85 | dotnet_diagnostic.CA1027.severity = warning
86 |
87 | # CA1028: Enum Storage should be Int32
88 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1028
89 | # Enabled: False, Severity: warning
90 | dotnet_diagnostic.CA1028.severity = none
91 |
92 | # CA1030: Use events where appropriate
93 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030
94 | # Enabled: False, Severity: warning
95 | dotnet_diagnostic.CA1030.severity = warning
96 |
97 | # CA1031: Do not catch general exception types
98 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031
99 | # Enabled: False, Severity: warning
100 | dotnet_diagnostic.CA1031.severity = none
101 |
102 | # CA1032: Implement standard exception constructors
103 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1032
104 | # Enabled: False, Severity: warning
105 | dotnet_diagnostic.CA1032.severity = warning
106 |
107 | # CA1033: Interface methods should be callable by child types
108 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033
109 | # Enabled: False, Severity: warning
110 | dotnet_diagnostic.CA1033.severity = none
111 |
112 | # CA1034: Nested types should not be visible
113 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1034
114 | # Enabled: False, Severity: warning
115 | dotnet_diagnostic.CA1034.severity = warning
116 |
117 | # CA1036: Override methods on comparable types
118 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1036
119 | # Enabled: True, Severity: silent
120 | dotnet_diagnostic.CA1036.severity = warning
121 |
122 | # CA1040: Avoid empty interfaces
123 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1040
124 | # Enabled: False, Severity: warning
125 | dotnet_diagnostic.CA1040.severity = warning
126 |
127 | # CA1041: Provide ObsoleteAttribute message
128 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1041
129 | # Enabled: True, Severity: suggestion
130 | dotnet_diagnostic.CA1041.severity = warning
131 |
132 | # CA1043: Use Integral Or String Argument For Indexers
133 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1043
134 | # Enabled: False, Severity: warning
135 | dotnet_diagnostic.CA1043.severity = none
136 |
137 | # CA1044: Properties should not be write only
138 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1044
139 | # Enabled: False, Severity: warning
140 | dotnet_diagnostic.CA1044.severity = none
141 |
142 | # CA1045: Do not pass types by reference
143 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1045
144 | # Enabled: False, Severity: warning
145 | dotnet_diagnostic.CA1045.severity = none
146 |
147 | # CA1046: Do not overload equality operator on reference types
148 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1046
149 | # Enabled: False, Severity: warning
150 | dotnet_diagnostic.CA1046.severity = none
151 |
152 | # CA1047: Do not declare protected member in sealed type
153 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1047
154 | # Enabled: True, Severity: suggestion
155 | dotnet_diagnostic.CA1047.severity = warning
156 |
157 | # CA1050: Declare types in namespaces
158 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1050
159 | # Enabled: True, Severity: suggestion
160 | dotnet_diagnostic.CA1050.severity = warning
161 |
162 | # CA1051: Do not declare visible instance fields
163 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1051
164 | # Enabled: True, Severity: silent
165 | dotnet_diagnostic.CA1051.severity = warning
166 |
167 | # CA1052: Static holder types should be Static or NotInheritable
168 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052
169 | # Enabled: False, Severity: warning
170 | dotnet_diagnostic.CA1052.severity = warning
171 |
172 | # CA1054: URI-like parameters should not be strings
173 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1054
174 | # Enabled: False, Severity: warning
175 | dotnet_diagnostic.CA1054.severity = warning
176 |
177 | # CA1055: URI-like return values should not be strings
178 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1055
179 | # Enabled: False, Severity: warning
180 | dotnet_diagnostic.CA1055.severity = warning
181 |
182 | # CA1056: URI-like properties should not be strings
183 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1056
184 | # Enabled: False, Severity: warning
185 | dotnet_diagnostic.CA1056.severity = warning
186 |
187 | # CA1058: Types should not extend certain base types
188 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1058
189 | # Enabled: False, Severity: warning
190 | dotnet_diagnostic.CA1058.severity = warning
191 |
192 | # CA1060: Move pinvokes to native methods class
193 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1060
194 | # Enabled: False, Severity: warning
195 | dotnet_diagnostic.CA1060.severity = none
196 |
197 | # CA1061: Do not hide base class methods
198 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1061
199 | # Enabled: True, Severity: suggestion
200 | dotnet_diagnostic.CA1061.severity = warning
201 |
202 | # CA1062: Validate arguments of public methods
203 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1062
204 | # Enabled: False, Severity: warning
205 | dotnet_diagnostic.CA1062.severity = none
206 |
207 | # CA1063: Implement IDisposable Correctly
208 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063
209 | # Enabled: False, Severity: warning
210 | dotnet_diagnostic.CA1063.severity = none
211 |
212 | # CA1064: Exceptions should be public
213 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1064
214 | # Enabled: False, Severity: warning
215 | dotnet_diagnostic.CA1064.severity = warning
216 |
217 | # CA1065: Do not raise exceptions in unexpected locations
218 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1065
219 | # Enabled: False, Severity: warning
220 | dotnet_diagnostic.CA1065.severity = warning
221 |
222 | # CA1066: Implement IEquatable when overriding Object.Equals
223 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1066
224 | # Enabled: False, Severity: warning
225 | dotnet_diagnostic.CA1066.severity = warning
226 |
227 | # CA1067: Override Object.Equals(object) when implementing IEquatable
228 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1067
229 | # Enabled: True, Severity: suggestion
230 | dotnet_diagnostic.CA1067.severity = warning
231 |
232 | # CA1068: CancellationToken parameters must come last
233 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1068
234 | # Enabled: True, Severity: suggestion
235 | dotnet_diagnostic.CA1068.severity = warning
236 |
237 | # CA1069: Enums values should not be duplicated
238 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1069
239 | # Enabled: True, Severity: suggestion
240 | dotnet_diagnostic.CA1069.severity = warning
241 |
242 | # CA1070: Do not declare event fields as virtual
243 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1070
244 | # Enabled: True, Severity: suggestion
245 | dotnet_diagnostic.CA1070.severity = warning
246 |
247 | # CA1200: Avoid using cref tags with a prefix
248 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1200
249 | # Enabled: True, Severity: silent
250 | dotnet_diagnostic.CA1200.severity = warning
251 |
252 | # CA1303: Do not pass literals as localized parameters
253 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1303
254 | # Enabled: False, Severity: warning
255 | dotnet_diagnostic.CA1303.severity = none
256 |
257 | # CA1304: Specify CultureInfo
258 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304
259 | # Enabled: True, Severity: silent
260 | dotnet_diagnostic.CA1304.severity = warning
261 |
262 | # CA1305: Specify IFormatProvider
263 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1305
264 | # Enabled: True, Severity: silent
265 | # Reason: MA rules better handle exceptions (bool, Guid, etc.)
266 | dotnet_diagnostic.CA1305.severity = none
267 |
268 | # CA1307: Specify StringComparison for clarity
269 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1307
270 | # Enabled: False, Severity: warning
271 | dotnet_diagnostic.CA1307.severity = warning
272 |
273 | # CA1308: Normalize strings to uppercase
274 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1308
275 | # Enabled: False, Severity: warning
276 | dotnet_diagnostic.CA1308.severity = warning
277 |
278 | # CA1309: Use ordinal string comparison
279 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1309
280 | # Enabled: True, Severity: silent
281 | dotnet_diagnostic.CA1309.severity = warning
282 |
283 | # CA1310: Specify StringComparison for correctness
284 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1310
285 | # Enabled: True, Severity: silent
286 | dotnet_diagnostic.CA1310.severity = warning
287 |
288 | # CA1311: Specify a culture or use an invariant version
289 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1311
290 | # Enabled: True, Severity: silent
291 | dotnet_diagnostic.CA1311.severity = warning
292 |
293 | # CA1401: P/Invokes should not be visible
294 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1401
295 | # Enabled: True, Severity: suggestion
296 | dotnet_diagnostic.CA1401.severity = warning
297 |
298 | # CA1416: Validate platform compatibility
299 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416
300 | # Enabled: True, Severity: warning
301 | dotnet_diagnostic.CA1416.severity = warning
302 |
303 | # CA1417: Do not use 'OutAttribute' on string parameters for P/Invokes
304 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1417
305 | # Enabled: True, Severity: warning
306 | dotnet_diagnostic.CA1417.severity = warning
307 |
308 | # CA1418: Use valid platform string
309 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1418
310 | # Enabled: True, Severity: warning
311 | dotnet_diagnostic.CA1418.severity = warning
312 |
313 | # CA1419: Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle'
314 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1419
315 | # Enabled: True, Severity: suggestion
316 | dotnet_diagnostic.CA1419.severity = warning
317 |
318 | # CA1420: Property, type, or attribute requires runtime marshalling
319 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1420
320 | # Enabled: True, Severity: warning
321 | dotnet_diagnostic.CA1420.severity = warning
322 |
323 | # CA1421: This method uses runtime marshalling even when the 'DisableRuntimeMarshallingAttribute' is applied
324 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1421
325 | # Enabled: True, Severity: suggestion
326 | dotnet_diagnostic.CA1421.severity = suggestion
327 |
328 | # CA1422: Validate platform compatibility
329 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422
330 | # Enabled: True, Severity: warning
331 | dotnet_diagnostic.CA1422.severity = warning
332 |
333 | # CA1501: Avoid excessive inheritance
334 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1501
335 | # Enabled: False, Severity: warning
336 | dotnet_diagnostic.CA1501.severity = none
337 |
338 | # CA1502: Avoid excessive complexity
339 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1502
340 | # Enabled: False, Severity: warning
341 | dotnet_diagnostic.CA1502.severity = none
342 |
343 | # CA1505: Avoid unmaintainable code
344 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1505
345 | # Enabled: False, Severity: warning
346 | dotnet_diagnostic.CA1505.severity = none
347 |
348 | # CA1506: Avoid excessive class coupling
349 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1506
350 | # Enabled: False, Severity: warning
351 | dotnet_diagnostic.CA1506.severity = none
352 |
353 | # CA1507: Use nameof to express symbol names
354 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507
355 | # Enabled: True, Severity: suggestion
356 | dotnet_diagnostic.CA1507.severity = warning
357 |
358 | # CA1508: Avoid dead conditional code
359 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508
360 | # Enabled: False, Severity: warning
361 | dotnet_diagnostic.CA1508.severity = warning
362 |
363 | # CA1509: Invalid entry in code metrics rule specification file
364 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509
365 | # Enabled: False, Severity: warning
366 | dotnet_diagnostic.CA1509.severity = none
367 |
368 | # CA1510: Use ArgumentNullException throw helper
369 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1510
370 | # Enabled: True, Severity: suggestion
371 | dotnet_diagnostic.CA1510.severity = warning
372 |
373 | # CA1511: Use ArgumentException throw helper
374 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1511
375 | # Enabled: True, Severity: suggestion
376 | dotnet_diagnostic.CA1511.severity = warning
377 |
378 | # CA1512: Use ArgumentOutOfRangeException throw helper
379 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1512
380 | # Enabled: True, Severity: suggestion
381 | dotnet_diagnostic.CA1512.severity = warning
382 |
383 | # CA1513: Use ObjectDisposedException throw helper
384 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1513
385 | # Enabled: True, Severity: suggestion
386 | dotnet_diagnostic.CA1513.severity = warning
387 |
388 | # CA1514: Avoid redundant length argument
389 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1514
390 | # Enabled: True, Severity: suggestion
391 | dotnet_diagnostic.CA1514.severity = suggestion
392 |
393 | # CA1515: Consider making public types internal
394 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1515
395 | # Enabled: False, Severity: warning
396 | dotnet_diagnostic.CA1515.severity = none
397 |
398 | # CA1700: Do not name enum values 'Reserved'
399 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1700
400 | # Enabled: False, Severity: warning
401 | dotnet_diagnostic.CA1700.severity = warning
402 |
403 | # CA1707: Identifiers should not contain underscores
404 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707
405 | # Enabled: True, Severity: silent
406 | dotnet_diagnostic.CA1707.severity = none
407 |
408 | # CA1708: Identifiers should differ by more than case
409 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1708
410 | # Enabled: True, Severity: silent
411 | dotnet_diagnostic.CA1708.severity = none
412 |
413 | # CA1710: Identifiers should have correct suffix
414 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710
415 | # Enabled: True, Severity: silent
416 | dotnet_diagnostic.CA1710.severity = none
417 |
418 | # CA1711: Identifiers should not have incorrect suffix
419 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1711
420 | # Enabled: True, Severity: silent
421 | dotnet_diagnostic.CA1711.severity = none
422 |
423 | # CA1712: Do not prefix enum values with type name
424 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1712
425 | # Enabled: True, Severity: silent
426 | dotnet_diagnostic.CA1712.severity = none
427 |
428 | # CA1713: Events should not have 'Before' or 'After' prefix
429 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1713
430 | # Enabled: False, Severity: warning
431 | dotnet_diagnostic.CA1713.severity = none
432 |
433 | # CA1715: Identifiers should have correct prefix
434 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1715
435 | # Enabled: True, Severity: silent
436 | dotnet_diagnostic.CA1715.severity = warning
437 |
438 | # CA1716: Identifiers should not match keywords
439 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1716
440 | # Enabled: True, Severity: silent
441 | dotnet_diagnostic.CA1716.severity = none
442 |
443 | # CA1720: Identifier contains type name
444 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1720
445 | # Enabled: True, Severity: silent
446 | dotnet_diagnostic.CA1720.severity = warning
447 |
448 | # CA1721: Property names should not match get methods
449 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1721
450 | # Enabled: False, Severity: warning
451 | dotnet_diagnostic.CA1721.severity = none
452 |
453 | # CA1724: Type names should not match namespaces
454 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724
455 | # Enabled: False, Severity: warning
456 | dotnet_diagnostic.CA1724.severity = none
457 |
458 | # CA1725: Parameter names should match base declaration
459 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725
460 | # Enabled: True, Severity: silent
461 | dotnet_diagnostic.CA1725.severity = warning
462 |
463 | # CA1727: Use PascalCase for named placeholders
464 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1727
465 | # Enabled: True, Severity: silent
466 | dotnet_diagnostic.CA1727.severity = warning
467 |
468 | # CA1802: Use literals where appropriate
469 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802
470 | # Enabled: False, Severity: warning
471 | dotnet_diagnostic.CA1802.severity = warning
472 |
473 | # CA1805: Do not initialize unnecessarily
474 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1805
475 | # Enabled: True, Severity: silent
476 | dotnet_diagnostic.CA1805.severity = warning
477 |
478 | # CA1806: Do not ignore method results
479 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1806
480 | # Enabled: True, Severity: suggestion
481 | dotnet_diagnostic.CA1806.severity = warning
482 |
483 | # CA1810: Initialize reference type static fields inline
484 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1810
485 | # Enabled: False, Severity: warning
486 | dotnet_diagnostic.CA1810.severity = warning
487 |
488 | # CA1812: Avoid uninstantiated internal classes
489 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812
490 | # Enabled: False, Severity: warning
491 | dotnet_diagnostic.CA1812.severity = warning
492 |
493 | # CA1813: Avoid unsealed attributes
494 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1813
495 | # Enabled: False, Severity: warning
496 | dotnet_diagnostic.CA1813.severity = warning
497 |
498 | # CA1814: Prefer jagged arrays over multidimensional
499 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1814
500 | # Enabled: False, Severity: warning
501 | dotnet_diagnostic.CA1814.severity = warning
502 |
503 | # CA1815: Override equals and operator equals on value types
504 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815
505 | # Enabled: False, Severity: warning
506 | # Reason: MA0065 reports only when "==" or "GetHashCode" is used
507 | dotnet_diagnostic.CA1815.severity = none
508 |
509 | # CA1816: Dispose methods should call SuppressFinalize
510 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1816
511 | # Enabled: True, Severity: suggestion
512 | # Use SafeHandle when possible: https://www.meziantou.net/stop-using-intptr-for-dealing-with-system-handles.htm
513 | dotnet_diagnostic.CA1816.severity = none
514 |
515 | # CA1819: Properties should not return arrays
516 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819
517 | # Enabled: False, Severity: warning
518 | dotnet_diagnostic.CA1819.severity = warning
519 |
520 | # CA1820: Test for empty strings using string length
521 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1820
522 | # Enabled: False, Severity: warning
523 | dotnet_diagnostic.CA1820.severity = warning
524 |
525 | # CA1821: Remove empty Finalizers
526 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1821
527 | # Enabled: True, Severity: suggestion
528 | dotnet_diagnostic.CA1821.severity = warning
529 |
530 | # CA1822: Mark members as static
531 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
532 | # Enabled: True, Severity: suggestion
533 | dotnet_diagnostic.CA1822.severity = warning
534 |
535 | # CA1823: Avoid unused private fields
536 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1823
537 | # Enabled: False, Severity: warning
538 | dotnet_diagnostic.CA1823.severity = warning
539 |
540 | # CA1824: Mark assemblies with NeutralResourcesLanguageAttribute
541 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1824
542 | # Enabled: True, Severity: suggestion
543 | dotnet_diagnostic.CA1824.severity = warning
544 |
545 | # CA1825: Avoid zero-length array allocations
546 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1825
547 | # Enabled: True, Severity: suggestion
548 | dotnet_diagnostic.CA1825.severity = warning
549 |
550 | # CA1826: Do not use Enumerable methods on indexable collections
551 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1826
552 | # Enabled: True, Severity: suggestion
553 | dotnet_diagnostic.CA1826.severity = warning
554 |
555 | # CA1827: Do not use Count() or LongCount() when Any() can be used
556 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1827
557 | # Enabled: True, Severity: suggestion
558 | dotnet_diagnostic.CA1827.severity = warning
559 |
560 | # CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
561 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1828
562 | # Enabled: True, Severity: suggestion
563 | dotnet_diagnostic.CA1828.severity = warning
564 |
565 | # CA1829: Use Length/Count property instead of Count() when available
566 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1829
567 | # Enabled: True, Severity: suggestion
568 | dotnet_diagnostic.CA1829.severity = warning
569 |
570 | # CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder
571 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1830
572 | # Enabled: True, Severity: suggestion
573 | dotnet_diagnostic.CA1830.severity = warning
574 |
575 | # CA1831: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
576 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1831
577 | # Enabled: True, Severity: warning
578 | dotnet_diagnostic.CA1831.severity = warning
579 |
580 | # CA1832: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
581 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1832
582 | # Enabled: True, Severity: suggestion
583 | dotnet_diagnostic.CA1832.severity = warning
584 |
585 | # CA1833: Use AsSpan or AsMemory instead of Range-based indexers when appropriate
586 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1833
587 | # Enabled: True, Severity: suggestion
588 | dotnet_diagnostic.CA1833.severity = warning
589 |
590 | # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
591 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1834
592 | # Enabled: True, Severity: suggestion
593 | dotnet_diagnostic.CA1834.severity = warning
594 |
595 | # CA1835: Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync'
596 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1835
597 | # Enabled: True, Severity: suggestion
598 | dotnet_diagnostic.CA1835.severity = warning
599 |
600 | # CA1836: Prefer IsEmpty over Count
601 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1836
602 | # Enabled: True, Severity: suggestion
603 | dotnet_diagnostic.CA1836.severity = warning
604 |
605 | # CA1837: Use 'Environment.ProcessId'
606 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1837
607 | # Enabled: True, Severity: suggestion
608 | dotnet_diagnostic.CA1837.severity = warning
609 |
610 | # CA1838: Avoid 'StringBuilder' parameters for P/Invokes
611 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1838
612 | # Enabled: True, Severity: silent
613 | dotnet_diagnostic.CA1838.severity = warning
614 |
615 | # CA1839: Use 'Environment.ProcessPath'
616 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1839
617 | # Enabled: True, Severity: suggestion
618 | dotnet_diagnostic.CA1839.severity = warning
619 |
620 | # CA1840: Use 'Environment.CurrentManagedThreadId'
621 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1840
622 | # Enabled: True, Severity: suggestion
623 | dotnet_diagnostic.CA1840.severity = warning
624 |
625 | # CA1841: Prefer Dictionary.Contains methods
626 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1841
627 | # Enabled: True, Severity: suggestion
628 | dotnet_diagnostic.CA1841.severity = warning
629 |
630 | # CA1842: Do not use 'WhenAll' with a single task
631 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1842
632 | # Enabled: True, Severity: suggestion
633 | dotnet_diagnostic.CA1842.severity = warning
634 |
635 | # CA1843: Do not use 'WaitAll' with a single task
636 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1843
637 | # Enabled: True, Severity: suggestion
638 | dotnet_diagnostic.CA1843.severity = warning
639 |
640 | # CA1844: Provide memory-based overrides of async methods when subclassing 'Stream'
641 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1844
642 | # Enabled: True, Severity: suggestion
643 | dotnet_diagnostic.CA1844.severity = warning
644 |
645 | # CA1845: Use span-based 'string.Concat'
646 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845
647 | # Enabled: True, Severity: suggestion
648 | dotnet_diagnostic.CA1845.severity = warning
649 |
650 | # CA1846: Prefer 'AsSpan' over 'Substring'
651 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1846
652 | # Enabled: True, Severity: suggestion
653 | dotnet_diagnostic.CA1846.severity = warning
654 |
655 | # CA1847: Use char literal for a single character lookup
656 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847
657 | # Enabled: True, Severity: suggestion
658 | dotnet_diagnostic.CA1847.severity = warning
659 |
660 | # CA1848: Use the LoggerMessage delegates
661 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848
662 | # Enabled: True, Severity: silent
663 | dotnet_diagnostic.CA1848.severity = warning
664 |
665 | # CA1849: Call async methods when in an async method
666 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1849
667 | # Enabled: False, Severity: warning
668 | dotnet_diagnostic.CA1849.severity = warning
669 |
670 | # CA1850: Prefer static 'HashData' method over 'ComputeHash'
671 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1850
672 | # Enabled: True, Severity: suggestion
673 | dotnet_diagnostic.CA1850.severity = warning
674 |
675 | # CA1851: Possible multiple enumerations of 'IEnumerable' collection
676 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1851
677 | # Enabled: False, Severity: warning
678 | dotnet_diagnostic.CA1851.severity = suggestion
679 |
680 | # CA1852: Seal internal types
681 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852
682 | # Enabled: True, Severity: silent
683 | dotnet_diagnostic.CA1852.severity = warning
684 |
685 | # CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)'
686 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1853
687 | # Enabled: True, Severity: suggestion
688 | dotnet_diagnostic.CA1853.severity = warning
689 |
690 | # CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
691 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854
692 | # Enabled: True, Severity: suggestion
693 | dotnet_diagnostic.CA1854.severity = warning
694 |
695 | # CA1855: Prefer 'Clear' over 'Fill'
696 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1855
697 | # Enabled: True, Severity: suggestion
698 | dotnet_diagnostic.CA1855.severity = warning
699 |
700 | # CA1856: Incorrect usage of ConstantExpected attribute
701 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1856
702 | # Enabled: True, Severity: error
703 | dotnet_diagnostic.CA1856.severity = warning
704 |
705 | # CA1857: A constant is expected for the parameter
706 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1857
707 | # Enabled: True, Severity: warning
708 | dotnet_diagnostic.CA1857.severity = warning
709 |
710 | # CA1858: Use 'StartsWith' instead of 'IndexOf'
711 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858
712 | # Enabled: True, Severity: suggestion
713 | dotnet_diagnostic.CA1858.severity = warning
714 |
715 | # CA1859: Use concrete types when possible for improved performance
716 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859
717 | # Enabled: True, Severity: suggestion
718 | dotnet_diagnostic.CA1859.severity = warning
719 |
720 | # CA1860: Avoid using 'Enumerable.Any()' extension method
721 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860
722 | # Enabled: True, Severity: suggestion
723 | dotnet_diagnostic.CA1860.severity = warning
724 |
725 | # CA1861: Avoid constant arrays as arguments
726 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861
727 | # Enabled: True, Severity: suggestion
728 | dotnet_diagnostic.CA1861.severity = suggestion
729 |
730 | # CA1862: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
731 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862
732 | # Enabled: True, Severity: suggestion
733 | dotnet_diagnostic.CA1862.severity = suggestion
734 |
735 | # CA1863: Use 'CompositeFormat'
736 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863
737 | # Enabled: True, Severity: silent
738 | dotnet_diagnostic.CA1863.severity = silent
739 |
740 | # CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
741 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864
742 | # Enabled: True, Severity: suggestion
743 | dotnet_diagnostic.CA1864.severity = suggestion
744 |
745 | # CA1865: Use char overload
746 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865
747 | # Enabled: True, Severity: suggestion
748 | dotnet_diagnostic.CA1865.severity = suggestion
749 |
750 | # CA1866: Use char overload
751 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866
752 | # Enabled: True, Severity: suggestion
753 | dotnet_diagnostic.CA1866.severity = suggestion
754 |
755 | # CA1867: Use char overload
756 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867
757 | # Enabled: False, Severity: warning
758 | dotnet_diagnostic.CA1867.severity = none
759 |
760 | # CA1868: Unnecessary call to 'Contains(item)'
761 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868
762 | # Enabled: True, Severity: suggestion
763 | dotnet_diagnostic.CA1868.severity = suggestion
764 |
765 | # CA1869: Cache and reuse 'JsonSerializerOptions' instances
766 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869
767 | # Enabled: True, Severity: suggestion
768 | dotnet_diagnostic.CA1869.severity = suggestion
769 |
770 | # CA1870: Use a cached 'SearchValues' instance
771 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870
772 | # Enabled: True, Severity: suggestion
773 | dotnet_diagnostic.CA1870.severity = suggestion
774 |
775 | # CA1871: Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull'
776 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1871
777 | # Enabled: True, Severity: suggestion
778 | dotnet_diagnostic.CA1871.severity = suggestion
779 |
780 | # CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString'
781 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1872
782 | # Enabled: True, Severity: suggestion
783 | dotnet_diagnostic.CA1872.severity = suggestion
784 |
785 | # CA1873: Avoid potentially expensive logging
786 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873
787 | # Enabled: True, Severity: suggestion
788 | dotnet_diagnostic.CA1873.severity = suggestion
789 |
790 | # CA1874: Use 'Regex.IsMatch'
791 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1874
792 | # Enabled: True, Severity: suggestion
793 | dotnet_diagnostic.CA1874.severity = suggestion
794 |
795 | # CA1875: Use 'Regex.Count'
796 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1875
797 | # Enabled: True, Severity: suggestion
798 | dotnet_diagnostic.CA1875.severity = suggestion
799 |
800 | # CA2000: Dispose objects before losing scope
801 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000
802 | # Enabled: False, Severity: warning
803 | dotnet_diagnostic.CA2000.severity = warning
804 |
805 | # CA2002: Do not lock on objects with weak identity
806 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2002
807 | # Enabled: False, Severity: warning
808 | dotnet_diagnostic.CA2002.severity = warning
809 |
810 | # CA2007: Consider calling ConfigureAwait on the awaited task
811 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007
812 | # Enabled: False, Severity: warning
813 | # Superseeded by MA0004
814 | dotnet_diagnostic.CA2007.severity = none
815 |
816 | # CA2008: Do not create tasks without passing a TaskScheduler
817 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2008
818 | # Enabled: False, Severity: warning
819 | dotnet_diagnostic.CA2008.severity = warning
820 |
821 | # CA2009: Do not call ToImmutableCollection on an ImmutableCollection value
822 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2009
823 | # Enabled: True, Severity: suggestion
824 | dotnet_diagnostic.CA2009.severity = warning
825 |
826 | # CA2011: Avoid infinite recursion
827 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2011
828 | # Enabled: True, Severity: suggestion
829 | dotnet_diagnostic.CA2011.severity = warning
830 |
831 | # CA2012: Use ValueTasks correctly
832 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2012
833 | # Enabled: True, Severity: suggestion
834 | dotnet_diagnostic.CA2012.severity = warning
835 |
836 | # CA2013: Do not use ReferenceEquals with value types
837 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2013
838 | # Enabled: True, Severity: warning
839 | dotnet_diagnostic.CA2013.severity = warning
840 |
841 | # CA2014: Do not use stackalloc in loops
842 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2014
843 | # Enabled: True, Severity: warning
844 | dotnet_diagnostic.CA2014.severity = warning
845 |
846 | # CA2015: Do not define finalizers for types derived from MemoryManager
847 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2015
848 | # Enabled: True, Severity: warning
849 | dotnet_diagnostic.CA2015.severity = warning
850 |
851 | # CA2016: Forward the 'CancellationToken' parameter to methods
852 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016
853 | # Enabled: True, Severity: suggestion
854 | dotnet_diagnostic.CA2016.severity = warning
855 |
856 | # CA2017: Parameter count mismatch
857 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2017
858 | # Enabled: True, Severity: warning
859 | dotnet_diagnostic.CA2017.severity = warning
860 |
861 | # CA2018: 'Buffer.BlockCopy' expects the number of bytes to be copied for the 'count' argument
862 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2018
863 | # Enabled: True, Severity: warning
864 | dotnet_diagnostic.CA2018.severity = warning
865 |
866 | # CA2019: Improper 'ThreadStatic' field initialization
867 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2019
868 | # Enabled: True, Severity: suggestion
869 | dotnet_diagnostic.CA2019.severity = warning
870 |
871 | # CA2020: Prevent behavioral change
872 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2020
873 | # Enabled: True, Severity: suggestion
874 | dotnet_diagnostic.CA2020.severity = warning
875 |
876 | # CA2021: Do not call Enumerable.Cast or Enumerable.OfType with incompatible types
877 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2021
878 | # Enabled: True, Severity: warning
879 | dotnet_diagnostic.CA2021.severity = warning
880 |
881 | # CA2022: Avoid inexact read with 'Stream.Read'
882 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2022
883 | # Enabled: True, Severity: warning
884 | dotnet_diagnostic.CA2022.severity = warning
885 |
886 | # CA2023: Invalid braces in message template
887 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2023
888 | # Enabled: True, Severity: warning
889 | dotnet_diagnostic.CA2023.severity = warning
890 |
891 | # CA2024: Do not use 'StreamReader.EndOfStream' in async methods
892 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2024
893 | # Enabled: True, Severity: warning
894 | dotnet_diagnostic.CA2024.severity = warning
895 |
896 | # CA2100: Review SQL queries for security vulnerabilities
897 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2100
898 | # Enabled: False, Severity: warning
899 | dotnet_diagnostic.CA2100.severity = warning
900 |
901 | # CA2101: Specify marshaling for P/Invoke string arguments
902 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2101
903 | # Enabled: True, Severity: suggestion
904 | dotnet_diagnostic.CA2101.severity = warning
905 |
906 | # CA2119: Seal methods that satisfy private interfaces
907 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2119
908 | # Enabled: False, Severity: warning
909 | dotnet_diagnostic.CA2119.severity = warning
910 |
911 | # CA2153: Do Not Catch Corrupted State Exceptions
912 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2153
913 | # Enabled: False, Severity: warning
914 | dotnet_diagnostic.CA2153.severity = warning
915 |
916 | # CA2200: Rethrow to preserve stack details
917 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2200
918 | # Enabled: True, Severity: warning
919 | dotnet_diagnostic.CA2200.severity = warning
920 |
921 | # CA2201: Do not raise reserved exception types
922 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2201
923 | # Enabled: True, Severity: silent
924 | dotnet_diagnostic.CA2201.severity = warning
925 |
926 | # CA2207: Initialize value type static fields inline
927 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2207
928 | # Enabled: False, Severity: warning
929 | dotnet_diagnostic.CA2207.severity = warning
930 |
931 | # CA2208: Instantiate argument exceptions correctly
932 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208
933 | # Enabled: True, Severity: suggestion
934 | dotnet_diagnostic.CA2208.severity = warning
935 |
936 | # CA2211: Non-constant fields should not be visible
937 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2211
938 | # Enabled: True, Severity: suggestion
939 | dotnet_diagnostic.CA2211.severity = warning
940 |
941 | # CA2213: Disposable fields should be disposed
942 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2213
943 | # Enabled: False, Severity: warning
944 | dotnet_diagnostic.CA2213.severity = warning
945 |
946 | # CA2214: Do not call overridable methods in constructors
947 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2214
948 | # Enabled: False, Severity: warning
949 | dotnet_diagnostic.CA2214.severity = warning
950 |
951 | # CA2215: Dispose methods should call base class dispose
952 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2215
953 | # Enabled: True, Severity: silent
954 | dotnet_diagnostic.CA2215.severity = warning
955 |
956 | # CA2216: Disposable types should declare finalizer
957 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2216
958 | # Enabled: False, Severity: warning
959 | dotnet_diagnostic.CA2216.severity = warning
960 |
961 | # CA2217: Do not mark enums with FlagsAttribute
962 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2217
963 | # Enabled: False, Severity: warning
964 | dotnet_diagnostic.CA2217.severity = warning
965 |
966 | # CA2218: Override GetHashCode on overriding Equals
967 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2218
968 | # Enabled: True, Severity: suggestion
969 | dotnet_diagnostic.CA2218.severity = warning
970 |
971 | # CA2219: Do not raise exceptions in finally clauses
972 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2219
973 | # Enabled: True, Severity: suggestion
974 | dotnet_diagnostic.CA2219.severity = warning
975 |
976 | # CA2224: Override Equals on overloading operator equals
977 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2224
978 | # Enabled: True, Severity: suggestion
979 | dotnet_diagnostic.CA2224.severity = warning
980 |
981 | # CA2225: Operator overloads have named alternates
982 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2225
983 | # Enabled: False, Severity: warning
984 | dotnet_diagnostic.CA2225.severity = none
985 |
986 | # CA2226: Operators should have symmetrical overloads
987 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2226
988 | # Enabled: False, Severity: warning
989 | dotnet_diagnostic.CA2226.severity = warning
990 |
991 | # CA2227: Collection properties should be read only
992 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2227
993 | # Enabled: False, Severity: warning
994 | dotnet_diagnostic.CA2227.severity = none
995 |
996 | # CA2231: Overload operator equals on overriding value type Equals
997 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231
998 | # Enabled: True, Severity: suggestion
999 | dotnet_diagnostic.CA2231.severity = warning
1000 |
1001 | # CA2234: Pass system uri objects instead of strings
1002 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234
1003 | # Enabled: False, Severity: warning
1004 | dotnet_diagnostic.CA2234.severity = warning
1005 |
1006 | # CA2235: Mark all non-serializable fields
1007 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2235
1008 | # Enabled: False, Severity: warning
1009 | dotnet_diagnostic.CA2235.severity = warning
1010 |
1011 | # CA2237: Mark ISerializable types with serializable
1012 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2237
1013 | # Enabled: False, Severity: warning
1014 | dotnet_diagnostic.CA2237.severity = warning
1015 |
1016 | # CA2241: Provide correct arguments to formatting methods
1017 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241
1018 | # Enabled: True, Severity: suggestion
1019 | dotnet_diagnostic.CA2241.severity = warning
1020 |
1021 | # CA2242: Test for NaN correctly
1022 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2242
1023 | # Enabled: True, Severity: suggestion
1024 | dotnet_diagnostic.CA2242.severity = warning
1025 |
1026 | # CA2243: Attribute string literals should parse correctly
1027 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2243
1028 | # Enabled: False, Severity: warning
1029 | dotnet_diagnostic.CA2243.severity = warning
1030 |
1031 | # CA2244: Do not duplicate indexed element initializations
1032 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2244
1033 | # Enabled: True, Severity: suggestion
1034 | dotnet_diagnostic.CA2244.severity = warning
1035 |
1036 | # CA2245: Do not assign a property to itself
1037 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2245
1038 | # Enabled: True, Severity: suggestion
1039 | dotnet_diagnostic.CA2245.severity = warning
1040 |
1041 | # CA2246: Assigning symbol and its member in the same statement
1042 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2246
1043 | # Enabled: True, Severity: suggestion
1044 | dotnet_diagnostic.CA2246.severity = warning
1045 |
1046 | # CA2247: Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum
1047 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2247
1048 | # Enabled: True, Severity: warning
1049 | dotnet_diagnostic.CA2247.severity = warning
1050 |
1051 | # CA2248: Provide correct 'enum' argument to 'Enum.HasFlag'
1052 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2248
1053 | # Enabled: True, Severity: suggestion
1054 | dotnet_diagnostic.CA2248.severity = warning
1055 |
1056 | # CA2249: Consider using 'string.Contains' instead of 'string.IndexOf'
1057 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2249
1058 | # Enabled: True, Severity: suggestion
1059 | dotnet_diagnostic.CA2249.severity = warning
1060 |
1061 | # CA2250: Use 'ThrowIfCancellationRequested'
1062 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2250
1063 | # Enabled: True, Severity: suggestion
1064 | dotnet_diagnostic.CA2250.severity = warning
1065 |
1066 | # CA2251: Use 'string.Equals'
1067 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2251
1068 | # Enabled: True, Severity: silent
1069 | dotnet_diagnostic.CA2251.severity = warning
1070 |
1071 | # CA2252: This API requires opting into preview features
1072 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2252
1073 | # Enabled: True, Severity: error
1074 | dotnet_diagnostic.CA2252.severity = warning
1075 |
1076 | # CA2253: Named placeholders should not be numeric values
1077 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2253
1078 | # Enabled: True, Severity: suggestion
1079 | dotnet_diagnostic.CA2253.severity = warning
1080 |
1081 | # CA2254: Template should be a static expression
1082 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2254
1083 | # Enabled: True, Severity: suggestion
1084 | dotnet_diagnostic.CA2254.severity = warning
1085 |
1086 | # CA2255: The 'ModuleInitializer' attribute should not be used in libraries
1087 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2255
1088 | # Enabled: True, Severity: warning
1089 | dotnet_diagnostic.CA2255.severity = warning
1090 |
1091 | # CA2256: All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface
1092 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2256
1093 | # Enabled: True, Severity: warning
1094 | dotnet_diagnostic.CA2256.severity = warning
1095 |
1096 | # CA2257: Members defined on an interface with the 'DynamicInterfaceCastableImplementationAttribute' should be 'static'
1097 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2257
1098 | # Enabled: True, Severity: warning
1099 | dotnet_diagnostic.CA2257.severity = warning
1100 |
1101 | # CA2258: Providing a 'DynamicInterfaceCastableImplementation' interface in Visual Basic is unsupported
1102 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2258
1103 | # Enabled: True, Severity: warning
1104 | dotnet_diagnostic.CA2258.severity = warning
1105 |
1106 | # CA2259: 'ThreadStatic' only affects static fields
1107 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2259
1108 | # Enabled: True, Severity: warning
1109 | dotnet_diagnostic.CA2259.severity = warning
1110 |
1111 | # CA2260: Use correct type parameter
1112 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260
1113 | # Enabled: True, Severity: warning
1114 | dotnet_diagnostic.CA2260.severity = warning
1115 |
1116 | # CA2261: Do not use ConfigureAwaitOptions.SuppressThrowing with Task
1117 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261
1118 | # Enabled: True, Severity: warning
1119 | dotnet_diagnostic.CA2261.severity = warning
1120 |
1121 | # CA2262: Set 'MaxResponseHeadersLength' properly
1122 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2262
1123 | # Enabled: True, Severity: suggestion
1124 | dotnet_diagnostic.CA2262.severity = warning
1125 |
1126 | # CA2263: Prefer generic overload when type is known
1127 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2263
1128 | # Enabled: True, Severity: suggestion
1129 | dotnet_diagnostic.CA2263.severity = suggestion
1130 |
1131 | # CA2264: Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull'
1132 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2264
1133 | # Enabled: True, Severity: warning
1134 | dotnet_diagnostic.CA2264.severity = warning
1135 |
1136 | # CA2265: Do not compare Span to 'null' or 'default'
1137 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265
1138 | # Enabled: True, Severity: warning
1139 | dotnet_diagnostic.CA2265.severity = warning
1140 |
1141 | # CA2300: Do not use insecure deserializer BinaryFormatter
1142 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300
1143 | # Enabled: False, Severity: warning
1144 | dotnet_diagnostic.CA2300.severity = warning
1145 |
1146 | # CA2301: Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder
1147 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2301
1148 | # Enabled: False, Severity: warning
1149 | dotnet_diagnostic.CA2301.severity = warning
1150 |
1151 | # CA2302: Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize
1152 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2302
1153 | # Enabled: False, Severity: warning
1154 | dotnet_diagnostic.CA2302.severity = warning
1155 |
1156 | # CA2305: Do not use insecure deserializer LosFormatter
1157 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2305
1158 | # Enabled: False, Severity: warning
1159 | dotnet_diagnostic.CA2305.severity = warning
1160 |
1161 | # CA2310: Do not use insecure deserializer NetDataContractSerializer
1162 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2310
1163 | # Enabled: False, Severity: warning
1164 | dotnet_diagnostic.CA2310.severity = warning
1165 |
1166 | # CA2311: Do not deserialize without first setting NetDataContractSerializer.Binder
1167 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2311
1168 | # Enabled: False, Severity: warning
1169 | dotnet_diagnostic.CA2311.severity = warning
1170 |
1171 | # CA2312: Ensure NetDataContractSerializer.Binder is set before deserializing
1172 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2312
1173 | # Enabled: False, Severity: warning
1174 | dotnet_diagnostic.CA2312.severity = warning
1175 |
1176 | # CA2315: Do not use insecure deserializer ObjectStateFormatter
1177 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2315
1178 | # Enabled: False, Severity: warning
1179 | dotnet_diagnostic.CA2315.severity = warning
1180 |
1181 | # CA2321: Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver
1182 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2321
1183 | # Enabled: False, Severity: warning
1184 | dotnet_diagnostic.CA2321.severity = warning
1185 |
1186 | # CA2322: Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver before deserializing
1187 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2322
1188 | # Enabled: False, Severity: warning
1189 | dotnet_diagnostic.CA2322.severity = warning
1190 |
1191 | # CA2326: Do not use TypeNameHandling values other than None
1192 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2326
1193 | # Enabled: False, Severity: warning
1194 | dotnet_diagnostic.CA2326.severity = warning
1195 |
1196 | # CA2327: Do not use insecure JsonSerializerSettings
1197 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2327
1198 | # Enabled: False, Severity: warning
1199 | dotnet_diagnostic.CA2327.severity = warning
1200 |
1201 | # CA2328: Ensure that JsonSerializerSettings are secure
1202 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2328
1203 | # Enabled: False, Severity: warning
1204 | dotnet_diagnostic.CA2328.severity = warning
1205 |
1206 | # CA2329: Do not deserialize with JsonSerializer using an insecure configuration
1207 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2329
1208 | # Enabled: False, Severity: warning
1209 | dotnet_diagnostic.CA2329.severity = warning
1210 |
1211 | # CA2330: Ensure that JsonSerializer has a secure configuration when deserializing
1212 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2330
1213 | # Enabled: False, Severity: warning
1214 | dotnet_diagnostic.CA2330.severity = warning
1215 |
1216 | # CA2350: Do not use DataTable.ReadXml() with untrusted data
1217 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2350
1218 | # Enabled: False, Severity: warning
1219 | dotnet_diagnostic.CA2350.severity = warning
1220 |
1221 | # CA2351: Do not use DataSet.ReadXml() with untrusted data
1222 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2351
1223 | # Enabled: False, Severity: warning
1224 | dotnet_diagnostic.CA2351.severity = warning
1225 |
1226 | # CA2352: Unsafe DataSet or DataTable in serializable type can be vulnerable to remote code execution attacks
1227 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2352
1228 | # Enabled: False, Severity: warning
1229 | dotnet_diagnostic.CA2352.severity = warning
1230 |
1231 | # CA2353: Unsafe DataSet or DataTable in serializable type
1232 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2353
1233 | # Enabled: False, Severity: warning
1234 | dotnet_diagnostic.CA2353.severity = warning
1235 |
1236 | # CA2354: Unsafe DataSet or DataTable in deserialized object graph can be vulnerable to remote code execution attacks
1237 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2354
1238 | # Enabled: False, Severity: warning
1239 | dotnet_diagnostic.CA2354.severity = warning
1240 |
1241 | # CA2355: Unsafe DataSet or DataTable type found in deserializable object graph
1242 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2355
1243 | # Enabled: False, Severity: warning
1244 | dotnet_diagnostic.CA2355.severity = warning
1245 |
1246 | # CA2356: Unsafe DataSet or DataTable type in web deserializable object graph
1247 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2356
1248 | # Enabled: False, Severity: warning
1249 | dotnet_diagnostic.CA2356.severity = warning
1250 |
1251 | # CA2361: Ensure auto-generated class containing DataSet.ReadXml() is not used with untrusted data
1252 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2361
1253 | # Enabled: False, Severity: warning
1254 | dotnet_diagnostic.CA2361.severity = warning
1255 |
1256 | # CA2362: Unsafe DataSet or DataTable in auto-generated serializable type can be vulnerable to remote code execution attacks
1257 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2362
1258 | # Enabled: False, Severity: warning
1259 | dotnet_diagnostic.CA2362.severity = warning
1260 |
1261 | # CA3001: Review code for SQL injection vulnerabilities
1262 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3001
1263 | # Enabled: False, Severity: warning
1264 | dotnet_diagnostic.CA3001.severity = warning
1265 |
1266 | # CA3002: Review code for XSS vulnerabilities
1267 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3002
1268 | # Enabled: False, Severity: warning
1269 | dotnet_diagnostic.CA3002.severity = warning
1270 |
1271 | # CA3003: Review code for file path injection vulnerabilities
1272 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3003
1273 | # Enabled: False, Severity: warning
1274 | dotnet_diagnostic.CA3003.severity = warning
1275 |
1276 | # CA3004: Review code for information disclosure vulnerabilities
1277 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3004
1278 | # Enabled: False, Severity: warning
1279 | dotnet_diagnostic.CA3004.severity = warning
1280 |
1281 | # CA3005: Review code for LDAP injection vulnerabilities
1282 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3005
1283 | # Enabled: False, Severity: warning
1284 | dotnet_diagnostic.CA3005.severity = warning
1285 |
1286 | # CA3006: Review code for process command injection vulnerabilities
1287 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3006
1288 | # Enabled: False, Severity: warning
1289 | dotnet_diagnostic.CA3006.severity = warning
1290 |
1291 | # CA3007: Review code for open redirect vulnerabilities
1292 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3007
1293 | # Enabled: False, Severity: warning
1294 | dotnet_diagnostic.CA3007.severity = warning
1295 |
1296 | # CA3008: Review code for XPath injection vulnerabilities
1297 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3008
1298 | # Enabled: False, Severity: warning
1299 | dotnet_diagnostic.CA3008.severity = warning
1300 |
1301 | # CA3009: Review code for XML injection vulnerabilities
1302 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3009
1303 | # Enabled: False, Severity: warning
1304 | dotnet_diagnostic.CA3009.severity = warning
1305 |
1306 | # CA3010: Review code for XAML injection vulnerabilities
1307 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3010
1308 | # Enabled: False, Severity: warning
1309 | dotnet_diagnostic.CA3010.severity = warning
1310 |
1311 | # CA3011: Review code for DLL injection vulnerabilities
1312 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3011
1313 | # Enabled: False, Severity: warning
1314 | dotnet_diagnostic.CA3011.severity = warning
1315 |
1316 | # CA3012: Review code for regex injection vulnerabilities
1317 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3012
1318 | # Enabled: False, Severity: warning
1319 | dotnet_diagnostic.CA3012.severity = warning
1320 |
1321 | # CA3061: Do Not Add Schema By URL
1322 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3061
1323 | # Enabled: True, Severity: silent
1324 | dotnet_diagnostic.CA3061.severity = warning
1325 |
1326 | # CA3075: Insecure DTD processing in XML
1327 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3075
1328 | # Enabled: True, Severity: silent
1329 | dotnet_diagnostic.CA3075.severity = warning
1330 |
1331 | # CA3076: Insecure XSLT script processing
1332 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3076
1333 | # Enabled: True, Severity: silent
1334 | dotnet_diagnostic.CA3076.severity = warning
1335 |
1336 | # CA3077: Insecure Processing in API Design, XmlDocument and XmlTextReader
1337 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3077
1338 | # Enabled: True, Severity: silent
1339 | dotnet_diagnostic.CA3077.severity = warning
1340 |
1341 | # CA3147: Mark Verb Handlers With Validate Antiforgery Token
1342 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca3147
1343 | # Enabled: True, Severity: silent
1344 | dotnet_diagnostic.CA3147.severity = warning
1345 |
1346 | # CA5350: Do Not Use Weak Cryptographic Algorithms
1347 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5350
1348 | # Enabled: True, Severity: silent
1349 | dotnet_diagnostic.CA5350.severity = warning
1350 |
1351 | # CA5351: Do Not Use Broken Cryptographic Algorithms
1352 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5351
1353 | # Enabled: True, Severity: silent
1354 | dotnet_diagnostic.CA5351.severity = warning
1355 |
1356 | # CA5358: Review cipher mode usage with cryptography experts
1357 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5358
1358 | # Enabled: False, Severity: warning
1359 | dotnet_diagnostic.CA5358.severity = warning
1360 |
1361 | # CA5359: Do Not Disable Certificate Validation
1362 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5359
1363 | # Enabled: True, Severity: silent
1364 | dotnet_diagnostic.CA5359.severity = warning
1365 |
1366 | # CA5360: Do Not Call Dangerous Methods In Deserialization
1367 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5360
1368 | # Enabled: True, Severity: silent
1369 | dotnet_diagnostic.CA5360.severity = warning
1370 |
1371 | # CA5361: Do Not Disable SChannel Use of Strong Crypto
1372 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5361
1373 | # Enabled: False, Severity: warning
1374 | dotnet_diagnostic.CA5361.severity = warning
1375 |
1376 | # CA5362: Potential reference cycle in deserialized object graph
1377 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5362
1378 | # Enabled: False, Severity: warning
1379 | dotnet_diagnostic.CA5362.severity = warning
1380 |
1381 | # CA5363: Do Not Disable Request Validation
1382 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5363
1383 | # Enabled: True, Severity: silent
1384 | dotnet_diagnostic.CA5363.severity = warning
1385 |
1386 | # CA5364: Do Not Use Deprecated Security Protocols
1387 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5364
1388 | # Enabled: True, Severity: silent
1389 | dotnet_diagnostic.CA5364.severity = warning
1390 |
1391 | # CA5365: Do Not Disable HTTP Header Checking
1392 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5365
1393 | # Enabled: True, Severity: silent
1394 | dotnet_diagnostic.CA5365.severity = warning
1395 |
1396 | # CA5366: Use XmlReader for 'DataSet.ReadXml()'
1397 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5366
1398 | # Enabled: True, Severity: silent
1399 | dotnet_diagnostic.CA5366.severity = warning
1400 |
1401 | # CA5367: Do Not Serialize Types With Pointer Fields
1402 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5367
1403 | # Enabled: False, Severity: warning
1404 | dotnet_diagnostic.CA5367.severity = warning
1405 |
1406 | # CA5368: Set ViewStateUserKey For Classes Derived From Page
1407 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5368
1408 | # Enabled: True, Severity: silent
1409 | dotnet_diagnostic.CA5368.severity = warning
1410 |
1411 | # CA5369: Use XmlReader for 'XmlSerializer.Deserialize()'
1412 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5369
1413 | # Enabled: True, Severity: silent
1414 | dotnet_diagnostic.CA5369.severity = warning
1415 |
1416 | # CA5370: Use XmlReader for XmlValidatingReader constructor
1417 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5370
1418 | # Enabled: True, Severity: silent
1419 | dotnet_diagnostic.CA5370.severity = warning
1420 |
1421 | # CA5371: Use XmlReader for 'XmlSchema.Read()'
1422 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5371
1423 | # Enabled: True, Severity: silent
1424 | dotnet_diagnostic.CA5371.severity = warning
1425 |
1426 | # CA5372: Use XmlReader for XPathDocument constructor
1427 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5372
1428 | # Enabled: True, Severity: silent
1429 | dotnet_diagnostic.CA5372.severity = warning
1430 |
1431 | # CA5373: Do not use obsolete key derivation function
1432 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5373
1433 | # Enabled: True, Severity: silent
1434 | dotnet_diagnostic.CA5373.severity = warning
1435 |
1436 | # CA5374: Do Not Use XslTransform
1437 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5374
1438 | # Enabled: True, Severity: silent
1439 | dotnet_diagnostic.CA5374.severity = warning
1440 |
1441 | # CA5375: Do Not Use Account Shared Access Signature
1442 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5375
1443 | # Enabled: False, Severity: warning
1444 | dotnet_diagnostic.CA5375.severity = warning
1445 |
1446 | # CA5376: Use SharedAccessProtocol HttpsOnly
1447 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5376
1448 | # Enabled: False, Severity: warning
1449 | dotnet_diagnostic.CA5376.severity = warning
1450 |
1451 | # CA5377: Use Container Level Access Policy
1452 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5377
1453 | # Enabled: False, Severity: warning
1454 | dotnet_diagnostic.CA5377.severity = warning
1455 |
1456 | # CA5378: Do not disable ServicePointManagerSecurityProtocols
1457 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5378
1458 | # Enabled: False, Severity: warning
1459 | dotnet_diagnostic.CA5378.severity = warning
1460 |
1461 | # CA5379: Ensure Key Derivation Function algorithm is sufficiently strong
1462 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5379
1463 | # Enabled: True, Severity: silent
1464 | dotnet_diagnostic.CA5379.severity = warning
1465 |
1466 | # CA5380: Do Not Add Certificates To Root Store
1467 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5380
1468 | # Enabled: False, Severity: warning
1469 | dotnet_diagnostic.CA5380.severity = warning
1470 |
1471 | # CA5381: Ensure Certificates Are Not Added To Root Store
1472 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5381
1473 | # Enabled: False, Severity: warning
1474 | dotnet_diagnostic.CA5381.severity = warning
1475 |
1476 | # CA5382: Use Secure Cookies In ASP.NET Core
1477 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5382
1478 | # Enabled: False, Severity: warning
1479 | dotnet_diagnostic.CA5382.severity = warning
1480 |
1481 | # CA5383: Ensure Use Secure Cookies In ASP.NET Core
1482 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5383
1483 | # Enabled: False, Severity: warning
1484 | dotnet_diagnostic.CA5383.severity = warning
1485 |
1486 | # CA5384: Do Not Use Digital Signature Algorithm (DSA)
1487 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5384
1488 | # Enabled: True, Severity: silent
1489 | dotnet_diagnostic.CA5384.severity = warning
1490 |
1491 | # CA5385: Use Rivest-Shamir-Adleman (RSA) Algorithm With Sufficient Key Size
1492 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5385
1493 | # Enabled: True, Severity: silent
1494 | dotnet_diagnostic.CA5385.severity = warning
1495 |
1496 | # CA5386: Avoid hardcoding SecurityProtocolType value
1497 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5386
1498 | # Enabled: False, Severity: warning
1499 | dotnet_diagnostic.CA5386.severity = warning
1500 |
1501 | # CA5387: Do Not Use Weak Key Derivation Function With Insufficient Iteration Count
1502 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5387
1503 | # Enabled: False, Severity: warning
1504 | dotnet_diagnostic.CA5387.severity = warning
1505 |
1506 | # CA5388: Ensure Sufficient Iteration Count When Using Weak Key Derivation Function
1507 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5388
1508 | # Enabled: False, Severity: warning
1509 | dotnet_diagnostic.CA5388.severity = warning
1510 |
1511 | # CA5389: Do Not Add Archive Item's Path To The Target File System Path
1512 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5389
1513 | # Enabled: False, Severity: warning
1514 | dotnet_diagnostic.CA5389.severity = warning
1515 |
1516 | # CA5390: Do not hard-code encryption key
1517 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5390
1518 | # Enabled: False, Severity: warning
1519 | dotnet_diagnostic.CA5390.severity = warning
1520 |
1521 | # CA5391: Use antiforgery tokens in ASP.NET Core MVC controllers
1522 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5391
1523 | # Enabled: False, Severity: warning
1524 | dotnet_diagnostic.CA5391.severity = warning
1525 |
1526 | # CA5392: Use DefaultDllImportSearchPaths attribute for P/Invokes
1527 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5392
1528 | # Enabled: False, Severity: warning
1529 | dotnet_diagnostic.CA5392.severity = warning
1530 |
1531 | # CA5393: Do not use unsafe DllImportSearchPath value
1532 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5393
1533 | # Enabled: False, Severity: warning
1534 | dotnet_diagnostic.CA5393.severity = warning
1535 |
1536 | # CA5394: Do not use insecure randomness
1537 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5394
1538 | # Enabled: False, Severity: warning
1539 | dotnet_diagnostic.CA5394.severity = warning
1540 |
1541 | # CA5395: Miss HttpVerb attribute for action methods
1542 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5395
1543 | # Enabled: False, Severity: warning
1544 | dotnet_diagnostic.CA5395.severity = warning
1545 |
1546 | # CA5396: Set HttpOnly to true for HttpCookie
1547 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5396
1548 | # Enabled: False, Severity: warning
1549 | dotnet_diagnostic.CA5396.severity = warning
1550 |
1551 | # CA5397: Do not use deprecated SslProtocols values
1552 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5397
1553 | # Enabled: True, Severity: silent
1554 | dotnet_diagnostic.CA5397.severity = warning
1555 |
1556 | # CA5398: Avoid hardcoded SslProtocols values
1557 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5398
1558 | # Enabled: False, Severity: warning
1559 | dotnet_diagnostic.CA5398.severity = warning
1560 |
1561 | # CA5399: HttpClients should enable certificate revocation list checks
1562 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5399
1563 | # Enabled: False, Severity: warning
1564 | dotnet_diagnostic.CA5399.severity = warning
1565 |
1566 | # CA5400: Ensure HttpClient certificate revocation list check is not disabled
1567 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5400
1568 | # Enabled: False, Severity: warning
1569 | dotnet_diagnostic.CA5400.severity = warning
1570 |
1571 | # CA5401: Do not use CreateEncryptor with non-default IV
1572 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5401
1573 | # Enabled: False, Severity: warning
1574 | dotnet_diagnostic.CA5401.severity = warning
1575 |
1576 | # CA5402: Use CreateEncryptor with the default IV
1577 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5402
1578 | # Enabled: False, Severity: warning
1579 | dotnet_diagnostic.CA5402.severity = warning
1580 |
1581 | # CA5403: Do not hard-code certificate
1582 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5403
1583 | # Enabled: False, Severity: warning
1584 | dotnet_diagnostic.CA5403.severity = warning
1585 |
1586 | # CA5404: Do not disable token validation checks
1587 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5404
1588 | # Enabled: False, Severity: warning
1589 | dotnet_diagnostic.CA5404.severity = warning
1590 |
1591 | # CA5405: Do not always skip token validation in delegates
1592 | # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405
1593 | # Enabled: False, Severity: warning
1594 | dotnet_diagnostic.CA5405.severity = warning
1595 |
1596 |
--------------------------------------------------------------------------------
/src/configuration/Analyzers.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | global_level = 0 # higher than the NET Analyzer files
3 |
4 | dotnet_style_prefer_foreach_explicit_cast_in_source=when_strongly_typed
5 |
6 | # Remove this or Me qualification
7 | dotnet_diagnostic.IDE0003.severity = suggestion
8 |
9 | # Remove unnecessary import
10 | dotnet_diagnostic.IDE0005.severity = suggestion
11 |
12 | # use var instead of explicit type
13 | dotnet_diagnostic.IDE0007.severity = suggestion
14 |
15 | # Add missing cases
16 | dotnet_diagnostic.IDE0010.severity = silent
17 |
18 | # Use throw expression
19 | dotnet_diagnostic.IDE0016.severity = silent
20 |
21 | # Use object initializers
22 | dotnet_diagnostic.IDE0017.severity = suggestion
23 |
24 | # Inline variable declaration
25 | dotnet_diagnostic.IDE0018.severity = suggestion
26 |
27 | # Use pattern matching to avoid as followed by a null check
28 | dotnet_diagnostic.IDE0019.severity = suggestion
29 |
30 | # Use pattern matching to avoid is check followed by a cast (with variable)
31 | dotnet_diagnostic.IDE0020.severity = suggestion
32 |
33 | # Use expression body for constructor
34 | dotnet_diagnostic.IDE0021.severity = silent
35 |
36 | # Use expression body for method
37 | dotnet_diagnostic.IDE0022.severity = silent
38 |
39 | # Use expression body for conversion operators
40 | dotnet_diagnostic.IDE0023.severity = silent
41 |
42 | # Use expression body for operators
43 | dotnet_diagnostic.IDE0024.severity = silent
44 |
45 | # Use expression body for properties
46 | dotnet_diagnostic.IDE0025.severity = silent
47 |
48 | # Use expression body for indexers
49 | dotnet_diagnostic.IDE0026.severity = silent
50 |
51 | # Use expression body for accessors
52 | dotnet_diagnostic.IDE0027.severity = silent
53 |
54 | # Use collection initializers
55 | dotnet_diagnostic.IDE0028.severity = suggestion
56 |
57 | # Null check can be simplified (ternary conditional check)
58 | dotnet_diagnostic.IDE0029.severity = suggestion
59 |
60 | # Null check can be simplified (nullable ternary conditional check)
61 | dotnet_diagnostic.IDE0030.severity = suggestion
62 |
63 | # Use null propagation
64 | dotnet_diagnostic.IDE0031.severity = suggestion
65 |
66 | # Use explicitly provided tuple name
67 | dotnet_diagnostic.IDE0033.severity = warning
68 |
69 | # Use auto-implemented property
70 | dotnet_diagnostic.IDE0032.severity = suggestion
71 |
72 | # Simplify 'default' expression
73 | dotnet_diagnostic.IDE0034.severity = suggestion
74 |
75 | # Remove unreachable code
76 | dotnet_diagnostic.IDE0035.severity = warning
77 |
78 | # Use inferred member name
79 | dotnet_diagnostic.IDE0037.severity = silent
80 |
81 | # Use pattern matching to avoid is check followed by a cast (without variable)
82 | dotnet_diagnostic.IDE0038.severity = suggestion
83 |
84 | # Use local function instead of lambda
85 | dotnet_diagnostic.IDE0039.severity = suggestion
86 |
87 | # Add accessibility modifiers
88 | dotnet_diagnostic.IDE0040.severity = warning
89 |
90 | # Deconstruct variable declaration
91 | dotnet_diagnostic.IDE0042.severity = suggestion
92 |
93 | # Add readonly modifier
94 | dotnet_diagnostic.IDE0044.severity = warning
95 |
96 | # 'if' statement can be simplified
97 | dotnet_diagnostic.IDE0045.severity = silent
98 | dotnet_diagnostic.IDE0046.severity = silent
99 |
100 | # Parentheses can be removed
101 | dotnet_diagnostic.IDE0047.severity = suggestion
102 |
103 | # Use language keywords instead of framework type names for type references
104 | dotnet_diagnostic.IDE0049.severity = warning
105 |
106 | # Remove unused private member
107 | dotnet_diagnostic.IDE0051.severity = warning
108 |
109 | # Remove unread private member
110 | dotnet_diagnostic.IDE0052.severity = warning
111 |
112 | # Use index operator
113 | dotnet_diagnostic.IDE0056.severity = suggestion
114 |
115 | # Use range operator
116 | dotnet_diagnostic.IDE0057.severity = suggestion
117 |
118 | # Remove unnecessary value assignment
119 | dotnet_diagnostic.IDE0059.severity = warning
120 | csharp_style_unused_value_assignment_preference = discard_variable
121 |
122 | # Remove unused parameter
123 | dotnet_diagnostic.IDE0060.severity = warning
124 |
125 | # Use expression body for local functions
126 | dotnet_diagnostic.IDE0061.severity = silent
127 |
128 | # Make local function static
129 | dotnet_diagnostic.IDE0062.severity = suggestion
130 |
131 | # 'using' directive placement
132 | dotnet_diagnostic.IDE0065.severity = suggestion
133 |
134 | # Use switch expression
135 | dotnet_diagnostic.IDE0066.severity = silent
136 |
137 | # Populate switch
138 | dotnet_diagnostic.IDE0072.severity = silent
139 |
140 | # Use pattern matching
141 | dotnet_diagnostic.IDE0078.severity = suggestion
142 |
143 | # Prefer null check over type check
144 | dotnet_diagnostic.IDE0150.severity = suggestion
145 |
146 | # Namespace declaration preferences
147 | dotnet_diagnostic.IDE0161.severity = suggestion
148 |
149 | # Lambda expression can be removed
150 | dotnet_diagnostic.IDE0200.severity = suggestion
151 |
152 | # Convert to top-level statements
153 | dotnet_diagnostic.IDE0210.severity = suggestion
154 |
155 | # Null check can be simplified
156 | dotnet_diagnostic.IDE0270.severity = silent
157 |
158 | # Use primary constructor
159 | dotnet_diagnostic.IDE0290.severity = silent
160 |
161 | # Collection initialization can be simplified
162 | dotnet_diagnostic.IDE0300.severity = suggestion
163 |
164 | # Collection expression can be simplified
165 | dotnet_diagnostic.IDE0301.severity = suggestion
166 |
167 | # Use collection expression for stackalloc
168 | dotnet_diagnostic.IDE0302.severity = suggestion
169 |
170 | # Use collection expression for Create()
171 | dotnet_diagnostic.IDE0303.severity = suggestion
172 |
173 | # Use collection expression for builder
174 | dotnet_diagnostic.IDE0304.severity = suggestion
175 |
176 | # Use collection expression for fluent
177 | dotnet_diagnostic.IDE0305.severity = suggestion
178 |
179 | # Use conditional delegate call
180 | dotnet_diagnostic.IDE1005.severity = suggestion
181 |
182 | # Remove unnecessary value assignment
183 | dotnet_diagnostic.IDE1006.severity = warning
184 |
--------------------------------------------------------------------------------
/src/configuration/BannedSymbols.txt:
--------------------------------------------------------------------------------
1 | P:System.DateTime.Now;Use System.DateTime.UtcNow instead
2 | P:System.DateTimeOffset.Now;Use System.DateTimeOffset.UtcNow instead
3 |
4 | P:System.IO.FileSystemInfo.CreationTime;Use CreationTimeUtc instead
5 | P:System.IO.FileSystemInfo.LastAccessTime;Use LastAccessTimeUtc instead
6 | P:System.IO.FileSystemInfo.LastWriteTime;Use LastWriteTimeUtc instead
7 |
8 | M:System.IO.File.GetCreationTime(System.String);Use GetCreationTimeUtc instead
9 | M:System.IO.File.GetCreationTime(Microsoft.Win32.SafeHandles.SafeFileHandle);Use GetCreationTimeUtc instead
10 | M:System.IO.File.GetLastAccessTime(System.String);Use GetLastAccessTimeUtc instead
11 | M:System.IO.File.GetLastAccessTime(Microsoft.Win32.SafeHandles.SafeFileHandle);Use GetLastAccessTimeUtc instead
12 | M:System.IO.File.GetLastWriteTime(System.String);Use GetLastWriteTimeUtc instead
13 | M:System.IO.File.GetLastWriteTime(Microsoft.Win32.SafeHandles.SafeFileHandle);Use GetLastWriteTimeUtc instead
14 | M:System.IO.File.SetCreationTime(System.String,System.DateTime);Use SetCreationTimeUtc instead
15 | M:System.IO.File.SetCreationTime(Microsoft.Win32.SafeHandles.SafeFileHandle,System.DateTime);Use SetCreationTimeUtc instead
16 | M:System.IO.File.SetLastAccessTime(System.String,System.DateTime);Use SetLastAccessTimeUtc instead
17 | M:System.IO.File.SetLastAccessTime(Microsoft.Win32.SafeHandles.SafeFileHandle,System.DateTime);Use SetLastAccessTimeUtc instead
18 | M:System.IO.File.SetLastWriteTime(System.String,System.DateTime);Use SetLastWriteTimeUtc instead
19 | M:System.IO.File.SetLastWriteTime(Microsoft.Win32.SafeHandles.SafeFileHandle,System.DateTime);Use SetLastWriteTimeUtc instead
20 |
21 | M:System.IO.Directory.GetCreationTime(System.String);Use GetCreationTimeUtc instead
22 | M:System.IO.Directory.GetLastWriteTime(System.String);Use GetLastWriteTimeUtc instead
23 | M:System.IO.Directory.GetLastAccessTime(System.String);Use GetLastAccessTimeUtc instead
24 | M:System.IO.Directory.SetCreationTime(System.String,System.DateTime);Use SetCreationTimeUtc instead
25 | M:System.IO.Directory.SetLastAccessTime(System.String,System.DateTime);Use SetLastAccessTimeUtc instead
26 | M:System.IO.Directory.SetLastWriteTime(System.String,System.DateTime);Use SetLastWriteTimeUtc instead
27 |
28 | F:System.StringComparison.InvariantCulture;Do you mean Ordinal?
29 | F:System.StringComparison.InvariantCultureIgnoreCase;Do you mean OrdinalIgnoreCase?
30 | P:System.StringComparer.InvariantCulture;Do you mean Ordinal?
31 | P:System.StringComparer.InvariantCultureIgnoreCase;Do you mean OrdinalIgnoreCase?
32 |
33 | M:System.Enum.TryParse(System.Type,System.String,System.Object);Use an overload with a ignoreCase argument
34 | M:System.Enum.TryParse(System.Type,System.ReadOnlySpan{System.Char},System.Object);Use an overload with a ignoreCase argument
35 | M:System.Enum.TryParse``1(System.String,``0@);Use an overload with a ignoreCase argument
36 | M:System.Enum.TryParse``1(System.ReadOnlySpan{System.Char},``0@);Use an overload with a ignoreCase argument
37 |
38 | M:System.Math.Round(System.Decimal);Use an overload with a MidpointRounding argument
39 | M:System.Math.Round(System.Decimal,System.Int32);Use an overload with a MidpointRounding argument
40 | M:System.Math.Round(System.Double);Use an overload with a MidpointRounding argument
41 | M:System.Math.Round(System.Double,System.Int32);Use an overload with a MidpointRounding argument
42 | M:System.MathF.Round(System.Single);Use an overload with a MidpointRounding argument
43 | M:System.MathF.Round(System.Single,System.Int32);Use an overload with a MidpointRounding argument
44 |
45 | M:System.Globalization.CultureInfo.#ctor(System.String);Use CultureInfo.GetCultureInfo
46 |
47 | T:System.Tuple`1;Use System.ValueTuple`1
48 | T:System.Tuple`2;Use System.ValueTuple`2
49 | T:System.Tuple`3;Use System.ValueTuple`3
50 | T:System.Tuple`4;Use System.ValueTuple`4
51 | T:System.Tuple`5;Use System.ValueTuple`5
52 | T:System.Tuple`6;Use System.ValueTuple`6
53 | T:System.Tuple`7;Use System.ValueTuple`7
54 | T:System.Tuple`8;Use System.ValueTuple`8
55 |
--------------------------------------------------------------------------------
/src/configuration/CodingStyle.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | global_level = 0
3 |
4 | charset = utf-8-bom
5 | indent_style = space
6 | indent_size = 4
7 | insert_final_newline = true
8 | trim_trailing_whitespace = true
9 |
10 | # New line preferences
11 | csharp_new_line_before_open_brace = all
12 | csharp_new_line_before_else = true
13 | csharp_new_line_before_catch = true
14 | csharp_new_line_before_finally = true
15 | csharp_new_line_before_members_in_object_initializers = true
16 | csharp_new_line_before_members_in_anonymous_types = true
17 | csharp_new_line_between_query_expression_clauses = true
18 |
19 | # Indentation preferences
20 | csharp_indent_block_contents = true
21 | csharp_indent_braces = false
22 | csharp_indent_case_contents = true
23 | csharp_indent_case_contents_when_block = false
24 | csharp_indent_switch_labels = true
25 | csharp_indent_labels = one_less_than_current
26 |
27 | # Modifier preferences
28 | csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
29 |
30 | # avoid this. unless absolutely necessary
31 | dotnet_style_qualification_for_field = false
32 | dotnet_style_qualification_for_property = false
33 | dotnet_style_qualification_for_method = false
34 | dotnet_style_qualification_for_event = false
35 |
36 | # Types: use keywords instead of BCL types, and permit var only when the type is clear
37 | csharp_style_var_for_built_in_types = true
38 | csharp_style_var_when_type_is_apparent = true
39 | csharp_style_var_elsewhere = true
40 | dotnet_style_predefined_type_for_locals_parameters_members = true
41 | dotnet_style_predefined_type_for_member_access = true
42 |
43 | # Use language keywords instead of framework type names for type references
44 | dotnet_style_predefined_type_for_locals_parameters_members = true
45 | dotnet_style_predefined_type_for_member_access = true
46 |
47 | # File style
48 | csharp_using_directive_placement = outside_namespace
49 | dotnet_sort_system_directives_first = true
50 | csharp_style_namespace_declarations = file_scoped
51 |
52 | # Expression-level preferences
53 | dotnet_style_coalesce_expression = true
54 | dotnet_style_collection_initializer = true
55 | dotnet_style_explicit_tuple_names = true
56 | dotnet_style_null_propagation = true
57 | dotnet_style_object_initializer = true
58 | dotnet_style_require_accessibility_modifiers = for_non_interface_members
59 |
60 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true
61 | dotnet_style_readonly_field = true
62 | dotnet_style_prefer_auto_properties = true
63 | dotnet_style_prefer_inferred_tuple_names = true
64 | dotnet_style_prefer_inferred_anonymous_type_member_names = true
65 | dotnet_style_prefer_conditional_expression_over_assignment = true
66 | dotnet_style_prefer_conditional_expression_over_return = true
67 |
68 | csharp_prefer_inferred_anonymous_type_member_names = true
69 | csharp_prefer_inferred_tuple_names = true
70 | csharp_prefer_simple_default_expression = true
71 | csharp_style_deconstructed_variable_declaration = true
72 | csharp_style_pattern_local_over_anonymous_function = true
73 | csharp_style_prefer_switch_expression = true
74 |
75 | # Expression-Bodied members
76 | csharp_style_expression_bodied_accessors = true
77 | csharp_style_expression_bodied_indexers = true
78 | csharp_style_expression_bodied_operators = true
79 | csharp_style_expression_bodied_properties = true
80 | csharp_style_expression_bodied_constructors = true
81 | csharp_style_expression_bodied_methods = true
82 | csharp_style_expression_bodied_local_functions = true
83 |
84 | # Pattern matching
85 | csharp_style_pattern_matching_over_as_with_null_check = true
86 | csharp_style_pattern_matching_over_is_with_cast_check = true
87 | csharp_style_inlined_variable_declaration = true
88 |
89 | # Null-checking preference
90 | csharp_style_conditional_delegate_call = true
91 | csharp_style_throw_expression = true
92 |
93 | # Other features
94 | csharp_style_prefer_index_operator = true
95 | csharp_style_prefer_range_operator = true
96 | csharp_style_pattern_local_over_anonymous_function = true
97 |
98 | # Code block preferences
99 | csharp_prefer_braces = when_multiline
100 |
101 | # Space preferences
102 | csharp_space_after_cast = false
103 | csharp_space_after_colon_in_inheritance_clause = true
104 | csharp_space_after_comma = true
105 | csharp_space_after_dot = false
106 | csharp_space_after_keywords_in_control_flow_statements = true
107 | csharp_space_after_semicolon_in_for_statement = true
108 | csharp_space_around_binary_operators = before_and_after
109 | csharp_space_around_declaration_statements = do_not_ignore
110 | csharp_space_before_colon_in_inheritance_clause = true
111 | csharp_space_before_comma = false
112 | csharp_space_before_dot = false
113 | csharp_space_before_open_square_brackets = false
114 | csharp_space_before_semicolon_in_for_statement = false
115 | csharp_space_between_empty_square_brackets = false
116 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
117 | csharp_space_between_method_call_name_and_opening_parenthesis = false
118 | csharp_space_between_method_call_parameter_list_parentheses = false
119 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
120 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
121 | csharp_space_between_method_declaration_parameter_list_parentheses = false
122 | csharp_space_between_parentheses = false
123 | csharp_space_between_square_brackets = false
124 |
125 | # Wrapping options
126 | csharp_preserve_single_line_blocks = true
127 | csharp_preserve_single_line_statements = false
128 |
129 | csharp_prefer_static_local_function = true
130 | dotnet_code_quality_unused_parameters = all
131 |
--------------------------------------------------------------------------------
/src/configuration/NamingConvention.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | global_level = 0
3 |
4 | dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
5 |
6 | # constant fields using PascalCase
7 | dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
8 | dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
9 | dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
10 | dotnet_naming_symbols.constant_fields.applicable_kinds = field
11 | dotnet_naming_symbols.constant_fields.required_modifiers = const
12 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case
13 |
14 | # static readonly fields using PascalCase (similar to constants)
15 | dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = suggestion
16 | dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields
17 | dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
18 | dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
19 | dotnet_naming_symbols.static_readonly_fields.required_modifiers = static,readonly
20 |
21 | # static fields should have s_ prefix
22 | dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
23 | dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
24 | dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
25 | dotnet_naming_symbols.static_fields.applicable_kinds = field
26 | dotnet_naming_symbols.static_fields.required_modifiers = static
27 | dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
28 | dotnet_naming_style.static_prefix_style.required_prefix = s_
29 | dotnet_naming_style.static_prefix_style.capitalization = camel_case
30 |
31 | # internal and private fields should be _camelCase
32 | dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
33 | dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
34 | dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
35 | dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
36 | dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
37 | dotnet_naming_style.camel_case_underscore_style.required_prefix = _
38 | dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
39 |
40 | # name all constant variables using PascalCase
41 | dotnet_naming_rule.constant_variables_should_be_pascal_case.severity = suggestion
42 | dotnet_naming_rule.constant_variables_should_be_pascal_case.symbols = constant_variables
43 | dotnet_naming_rule.constant_variables_should_be_pascal_case.style = pascal_case_style
44 | dotnet_naming_symbols.constant_variables.applicable_kinds = local
45 | dotnet_naming_symbols.constant_variables.required_modifiers = const
46 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case
47 |
48 | # Locals and parameters are camelCase
49 | dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
50 | dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
51 | dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
52 |
53 | dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
54 | dotnet_naming_style.camel_case_style.capitalization = camel_case
55 |
56 | # Local functions are PascalCase
57 | dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
58 | dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
59 | dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style
60 |
61 | dotnet_naming_symbols.local_functions.applicable_kinds = local_function
62 | dotnet_naming_style.local_function_style.capitalization = pascal_case
63 |
64 | # Type Parameters
65 | dotnet_naming_style.type_parameter_style.capitalization = pascal_case
66 | dotnet_naming_style.type_parameter_style.required_prefix = T
67 |
68 | dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol
69 | dotnet_naming_rule.type_parameter_naming.style = type_parameter_style
70 | dotnet_naming_rule.type_parameter_naming.severity = warning
71 | dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter
72 | dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = *
73 |
74 | # Interface
75 | dotnet_naming_style.interface_style.capitalization = pascal_case
76 | dotnet_naming_style.interface_style.required_prefix = I
77 |
78 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
79 | dotnet_naming_rule.interface_should_be_begins_with_i.style = interface_style
80 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface_symbols
81 |
82 | dotnet_naming_symbols.interface_symbols.applicable_kinds = interface
83 | dotnet_naming_symbols.interface_symbols.applicable_accessibilities = *
84 |
85 | # By default, name items with PascalCase
86 | dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
87 | dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
88 | dotnet_naming_rule.members_should_be_pascal_case.style = non_private_static_field_style
89 |
90 | dotnet_naming_symbols.all_members.applicable_kinds = *
91 |
92 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case
93 |
--------------------------------------------------------------------------------
/tests/Meziantou.DotNet.CodingStandard.Tests/CodingStandardTests.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO.Compression;
3 | using System.Reflection.PortableExecutable;
4 | using System.Text.Json;
5 | using System.Text.Json.Serialization;
6 | using System.Xml.Linq;
7 | using Meziantou.Framework;
8 | using Xunit.Abstractions;
9 |
10 | namespace Meziantou.DotNet.CodingStandard.Tests;
11 |
12 | public sealed class CodingStandardTests(PackageFixture fixture, ITestOutputHelper testOutputHelper) : IClassFixture
13 | {
14 | [Fact]
15 | public async Task BannedSymbolsAreReported()
16 | {
17 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
18 | project.AddCsprojFile();
19 | project.AddFile("sample.cs", """_ = System.DateTime.Now;""");
20 | var data = await project.BuildAndGetOutput();
21 | Assert.True(data.HasWarning("RS0030"));
22 | }
23 |
24 | [Fact]
25 | public async Task WarningsAsErrorOnGitHubActions()
26 | {
27 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
28 | project.AddCsprojFile();
29 | project.AddFile("sample.cs", """_ = System.DateTime.Now;""");
30 | var data = await project.BuildAndGetOutput(["/p:GITHUB_ACTIONS=true"]);
31 | Assert.True(data.HasError("RS0030"));
32 | }
33 |
34 | [Fact]
35 | public async Task NamingConvention_Invalid()
36 | {
37 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
38 | project.AddCsprojFile();
39 | project.AddFile("sample.cs", """
40 | _ = "";
41 |
42 | class Sample
43 | {
44 | private readonly int field;
45 |
46 | public Sample(int a) => field = a;
47 |
48 | public int A() => field;
49 | }
50 | """);
51 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
52 | Assert.True(data.HasError("IDE1006"));
53 | }
54 |
55 | [Fact]
56 | public async Task NamingConvention_Valid()
57 | {
58 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
59 | project.AddCsprojFile();
60 | project.AddFile("sample.cs", """
61 | _ = "";
62 |
63 | class Sample
64 | {
65 | private int _field;
66 | }
67 | """);
68 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
69 | Assert.False(data.HasError("IDE1006"));
70 | Assert.False(data.HasWarning("IDE1006"));
71 | }
72 |
73 | [Fact]
74 | public async Task CodingStyle_UseExpression()
75 | {
76 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
77 | project.AddCsprojFile();
78 | project.AddFile("Program.cs", """
79 | A();
80 |
81 | static void A()
82 | {
83 | System.Console.WriteLine();
84 | }
85 | """);
86 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
87 | Assert.False(data.HasWarning());
88 | Assert.False(data.HasError());
89 | }
90 |
91 | [Fact]
92 | public async Task CodingStyle_ExpressionIsNeverUsed()
93 | {
94 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
95 | project.AddCsprojFile();
96 | project.AddFile("Program.cs", """
97 | var sb = new System.Text.StringBuilder();
98 | sb.AppendLine();
99 |
100 | """);
101 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
102 | Assert.False(data.HasWarning());
103 | Assert.False(data.HasError());
104 | }
105 |
106 | [Fact]
107 | public async Task LocalEditorConfigCanOverrideSettings()
108 | {
109 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
110 | project.AddCsprojFile();
111 | project.AddFile("Program.cs", """
112 | _ = "";
113 |
114 | class Sample
115 | {
116 | public static void A()
117 | {
118 | B();
119 |
120 | static void B()
121 | {
122 | System.Console.WriteLine();
123 | }
124 | }
125 | }
126 |
127 | """);
128 | project.AddFile(".editorconfig", """
129 | [*.cs]
130 | csharp_style_expression_bodied_local_functions = true:warning
131 | """);
132 |
133 | var data = await project.BuildAndGetOutput(["--configuration", "Debug"]);
134 | Assert.True(data.HasWarning());
135 | Assert.False(data.HasError());
136 | }
137 |
138 | [Fact]
139 | public async Task NuGetAuditIsReportedAsErrorOnGitHubActions()
140 | {
141 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
142 | project.AddCsprojFile(nuGetPackages: [("System.Net.Http", "4.3.3")]);
143 | project.AddFile("Program.cs", """System.Console.WriteLine();""");
144 | var data = await project.BuildAndGetOutput(["/p:GITHUB_ACTIONS=true"]);
145 | Assert.True(data.OutputContains("error NU1903", StringComparison.Ordinal));
146 | Assert.Equal(1, data.ExitCode);
147 | }
148 |
149 | [Fact]
150 | public async Task NuGetAuditIsReportedAsWarning()
151 | {
152 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
153 | project.AddCsprojFile(nuGetPackages: [("System.Net.Http", "4.3.3")]);
154 | project.AddFile("Program.cs", """System.Console.WriteLine();""");
155 | var data = await project.BuildAndGetOutput();
156 | Assert.True(data.OutputContains("warning NU1903", StringComparison.Ordinal));
157 | Assert.True(data.OutputDoesNotContain("error NU1903", StringComparison.Ordinal));
158 | Assert.Equal(0, data.ExitCode);
159 | }
160 |
161 | [Fact]
162 | public async Task MSBuildWarningsAsError()
163 | {
164 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
165 | project.AddFile("Program.cs", """
166 | System.Console.WriteLine();
167 |
168 | """);
169 | project.AddCsprojFile(additionalProjectElements: [
170 | new XElement("Target", new XAttribute("Name", "Custom"), new XAttribute("BeforeTargets", "Build"),
171 | new XElement("Warning", new XAttribute("Text", "CustomWarning")))]);
172 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
173 |
174 | Assert.True(data.OutputContains("error : CustomWarning"));
175 | }
176 |
177 | [Fact]
178 | public async Task MSBuildWarningsAsError_NotEnableOnDebug()
179 | {
180 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
181 | project.AddFile("Program.cs", """System.Console.WriteLine();""");
182 | project.AddCsprojFile(additionalProjectElements: [
183 | new XElement("Target", new XAttribute("Name", "Custom"), new XAttribute("BeforeTargets", "Build"),
184 | new XElement("Warning", new XAttribute("Text", "CustomWarning")))]);
185 | var data = await project.BuildAndGetOutput(["--configuration", "Debug"]);
186 |
187 | Assert.True(data.OutputContains("warning : CustomWarning"));
188 | }
189 |
190 | [Fact]
191 | public async Task CA1708_NotReportedForFileLocalTypes()
192 | {
193 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
194 | project.AddCsprojFile();
195 | project.AddFile("Sample1.cs", """
196 | System.Console.WriteLine();
197 |
198 | class A {}
199 |
200 | file class Sample
201 | {
202 | }
203 | """);
204 | project.AddFile("Sample2.cs", """
205 | class B {}
206 |
207 | file class sample
208 | {
209 | }
210 | """);
211 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
212 | Assert.False(data.HasError("CA1708"));
213 | Assert.False(data.HasWarning("CA1708"));
214 | }
215 |
216 | [Fact]
217 | public async Task PdbShouldBeEmbedded_Dotnet_Build()
218 | {
219 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
220 | project.AddCsprojFile();
221 | project.AddFile("Program.cs", """
222 | Console.WriteLine();
223 |
224 | """);
225 |
226 | var data = await project.BuildAndGetOutput(["--configuration", "Release"]);
227 |
228 | var outputFiles = Directory.GetFiles(project.RootFolder / "bin", "*", SearchOption.AllDirectories);
229 | await AssertPdbIsEmbedded(outputFiles);
230 | }
231 |
232 | [Fact]
233 | public async Task PdbShouldBeEmbedded_Dotnet_Pack()
234 | {
235 | await using var project = new ProjectBuilder(fixture, testOutputHelper, this);
236 | project.AddCsprojFile();
237 | project.AddFile("Program.cs", """
238 | Console.WriteLine();
239 |
240 | """);
241 |
242 | var data = await project.PackAndGetOutput(["--configuration", "Release"]);
243 |
244 | var extractedPath = project.RootFolder / "extracted";
245 | var files = Directory.GetFiles(project.RootFolder / "bin" / "Release");
246 | Assert.Single(files); // Only the .nupkg should be generated
247 | var nupkg = files.Single(f => f.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase));
248 | ZipFile.ExtractToDirectory(nupkg, extractedPath);
249 |
250 | var outputFiles = Directory.GetFiles(extractedPath, "*", SearchOption.AllDirectories);
251 | await AssertPdbIsEmbedded(outputFiles);
252 | }
253 |
254 | private static async Task AssertPdbIsEmbedded(string[] outputFiles)
255 | {
256 | Assert.DoesNotContain(outputFiles, f => f.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase));
257 | var dllPath = outputFiles.Single(f => f.EndsWith(".dll", StringComparison.OrdinalIgnoreCase));
258 | await using var stream = File.OpenRead(dllPath);
259 | var peReader = new PEReader(stream);
260 | var debug = peReader.ReadDebugDirectory();
261 | Assert.Contains(debug, entry => entry.Type == DebugDirectoryEntryType.EmbeddedPortablePdb);
262 | }
263 |
264 | private sealed class ProjectBuilder : IAsyncDisposable
265 | {
266 | private const string SarifFileName = "BuildOutput.sarif";
267 |
268 | private readonly TemporaryDirectory _directory;
269 | private readonly ITestOutputHelper _testOutputHelper;
270 | private readonly CodingStandardTests _test;
271 |
272 | public FullPath RootFolder => _directory.FullPath;
273 |
274 | public ProjectBuilder(PackageFixture fixture, ITestOutputHelper testOutputHelper, CodingStandardTests test)
275 | {
276 | _testOutputHelper = testOutputHelper;
277 | _test = test;
278 | _directory = TemporaryDirectory.Create();
279 | _directory.CreateTextFile("NuGet.config", $"""
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 | """);
299 | }
300 |
301 | public ProjectBuilder AddFile(string relativePath, string content)
302 | {
303 | File.WriteAllText(_directory.FullPath / relativePath, content);
304 | return this;
305 | }
306 |
307 | public ProjectBuilder AddCsprojFile((string Name, string Value)[] properties = null, (string Name, string Version)[] nuGetPackages = null, XElement[] additionalProjectElements = null)
308 | {
309 | var propertiesElement = new XElement("PropertyGroup");
310 | if (properties != null)
311 | {
312 | foreach (var prop in properties)
313 | {
314 | propertiesElement.Add(new XElement(prop.Name), prop.Value);
315 | }
316 | }
317 |
318 | var packagesElement = new XElement("ItemGroup");
319 | if (nuGetPackages != null)
320 | {
321 | foreach (var package in nuGetPackages)
322 | {
323 | packagesElement.Add(new XElement("PackageReference", new XAttribute("Include", package.Name), new XAttribute("Version", package.Version)));
324 | }
325 | }
326 |
327 | var content = $"""
328 |
329 |
330 | false
331 | exe
332 | net$(NETCoreAppMaximumVersion)
333 | enable
334 | enable
335 | {SarifFileName},version=2.1
336 |
337 | {propertiesElement}
338 | {packagesElement}
339 |
340 |
341 |
342 | {string.Join('\n', additionalProjectElements?.Select(e => e.ToString()) ?? [])}
343 |
344 | """;
345 |
346 | File.WriteAllText(_directory.FullPath / "test.csproj", content);
347 | return this;
348 | }
349 | public Task BuildAndGetOutput(string[] buildArguments = null)
350 | {
351 | return this.ExecuteDotnetCommandAndGetOutput("build", buildArguments);
352 | }
353 |
354 | public Task PackAndGetOutput(string[] buildArguments = null)
355 | {
356 | return this.ExecuteDotnetCommandAndGetOutput("pack", buildArguments);
357 | }
358 |
359 | private async Task ExecuteDotnetCommandAndGetOutput(string command, string[] buildArguments = null)
360 | {
361 | var globaljsonPsi = new ProcessStartInfo("dotnet", "new global.json")
362 | {
363 | WorkingDirectory = _directory.FullPath,
364 | UseShellExecute = false,
365 | RedirectStandardOutput = true,
366 |
367 | RedirectStandardError = true,
368 | };
369 | var result = await globaljsonPsi.RunAsTaskAsync();
370 | _testOutputHelper.WriteLine("Process exit code: " + result.ExitCode);
371 | _testOutputHelper.WriteLine(result.Output.ToString());
372 |
373 | var psi = new ProcessStartInfo("dotnet")
374 | {
375 | WorkingDirectory = _directory.FullPath,
376 | RedirectStandardInput = true,
377 | RedirectStandardOutput = true,
378 | UseShellExecute = false,
379 | };
380 | psi.ArgumentList.Add(command);
381 | if (buildArguments != null)
382 | {
383 | foreach (var arg in buildArguments)
384 | {
385 | psi.ArgumentList.Add(arg);
386 | }
387 | }
388 |
389 | // Remove parent environment variables
390 | psi.Environment.Remove("CI");
391 | psi.Environment.Remove("GITHUB_ACTIONS");
392 |
393 | result = await psi.RunAsTaskAsync();
394 | _testOutputHelper.WriteLine("Process exit code: " + result.ExitCode);
395 | _testOutputHelper.WriteLine(result.Output.ToString());
396 |
397 | var bytes = File.ReadAllBytes(_directory.FullPath / SarifFileName);
398 | var sarif = JsonSerializer.Deserialize(bytes);
399 | _testOutputHelper.WriteLine("Sarif result:\n" + string.Join("\n", sarif.AllResults().Select(r => r.ToString())));
400 | return new BuildResult(result.ExitCode, result.Output, sarif);
401 | }
402 |
403 | public ValueTask DisposeAsync() => _directory.DisposeAsync();
404 | }
405 |
406 | private sealed record BuildResult(int ExitCode, ProcessOutputCollection ProcessOutput, SarifFile SarifFile)
407 | {
408 | public bool OutputContains(string value, StringComparison stringComparison = StringComparison.Ordinal) => ProcessOutput.Any(line => line.Text.Contains(value, stringComparison));
409 | public bool OutputDoesNotContain(string value, StringComparison stringComparison = StringComparison.Ordinal) => !ProcessOutput.Any(line => line.Text.Contains(value, stringComparison));
410 |
411 | public bool HasError() => SarifFile.AllResults().Any(r => r.Level == "error");
412 | public bool HasError(string ruleId) => SarifFile.AllResults().Any(r => r.Level == "error" && r.RuleId == ruleId);
413 | public bool HasWarning() => SarifFile.AllResults().Any(r => r.Level == "warning");
414 | public bool HasWarning(string ruleId) => SarifFile.AllResults().Any(r => r.Level == "warning" && r.RuleId == ruleId);
415 | public bool HasNote(string ruleId) => SarifFile.AllResults().Any(r => r.Level == "note" && r.RuleId == ruleId);
416 | }
417 |
418 | private sealed class SarifFile
419 | {
420 | [JsonPropertyName("runs")]
421 | public SarifFileRun[] Runs { get; set; }
422 |
423 | public IEnumerable AllResults() => Runs.SelectMany(r => r.Results);
424 | }
425 |
426 | private sealed class SarifFileRun
427 | {
428 | [JsonPropertyName("results")]
429 | public SarifFileRunResult[] Results { get; set; }
430 | }
431 |
432 | private sealed class SarifFileRunResult
433 | {
434 | [JsonPropertyName("ruleId")]
435 | public string RuleId { get; set; }
436 |
437 | [JsonPropertyName("level")]
438 | public string Level { get; set; }
439 |
440 | [JsonPropertyName("message")]
441 | public SarifFileRunResultMessage Message { get; set; }
442 |
443 | public override string ToString()
444 | {
445 | return $"{Level}:{RuleId} {Message}";
446 | }
447 | }
448 |
449 | private sealed class SarifFileRunResultMessage
450 | {
451 | [JsonPropertyName("text")]
452 | public string Text { get; set; }
453 |
454 | public override string ToString()
455 | {
456 | return Text;
457 | }
458 | }
459 | }
--------------------------------------------------------------------------------
/tests/Meziantou.DotNet.CodingStandard.Tests/Meziantou.DotNet.CodingStandard.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net$(NETCoreAppMaximumVersion)
5 | enable
6 |
7 | false
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | all
18 | runtime; build; native; contentfiles; analyzers; buildtransitive
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/tests/Meziantou.DotNet.CodingStandard.Tests/PackageFixture.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using Meziantou.Framework;
3 |
4 | namespace Meziantou.DotNet.CodingStandard.Tests;
5 |
6 | public sealed class PackageFixture : IAsyncLifetime
7 | {
8 | private readonly TemporaryDirectory _packageDirectory = TemporaryDirectory.Create();
9 |
10 | public FullPath PackageDirectory => _packageDirectory.FullPath;
11 |
12 | public async Task InitializeAsync()
13 | {
14 | if (Environment.GetEnvironmentVariable("CI") != null && Environment.GetEnvironmentVariable("NuGetDirectory") is { } path)
15 | {
16 | var files = Directory.GetFiles(path, "*.nupkg");
17 | if (files.Length > 0)
18 | {
19 | foreach (var file in files)
20 | {
21 | File.Copy(file, _packageDirectory.FullPath / Path.GetFileName(file));
22 | }
23 |
24 | return;
25 | }
26 | }
27 |
28 | // Build NuGet package
29 | var nugetPath = FullPath.GetTempPath() / $"nuget-{Guid.NewGuid()}.exe";
30 | await DownloadFileAsync("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", nugetPath);
31 | var nuspecPath = PathHelpers.GetRootDirectory() / "Meziantou.DotNet.CodingStandard.nuspec";
32 |
33 | var psi = new ProcessStartInfo(nugetPath);
34 | psi.ArgumentList.AddRange(["pack", nuspecPath, "-ForceEnglishOutput", "-Version", "999.9.9", "-OutputDirectory", _packageDirectory.FullPath]);
35 | await psi.RunAsTaskAsync();
36 | }
37 |
38 | public async Task DisposeAsync()
39 | {
40 | await _packageDirectory.DisposeAsync();
41 | }
42 |
43 | private static async Task DownloadFileAsync(string url, FullPath path)
44 | {
45 | path.CreateParentDirectory();
46 | await using var nugetStream = await SharedHttpClient.Instance.GetStreamAsync(url);
47 | await using var fileStream = File.Create(path);
48 | await nugetStream.CopyToAsync(fileStream);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/tests/Meziantou.DotNet.CodingStandard.Tests/PathHelpers.cs:
--------------------------------------------------------------------------------
1 | using Meziantou.Framework;
2 |
3 | namespace Meziantou.DotNet.CodingStandard.Tests;
4 |
5 | internal static class PathHelpers
6 | {
7 | public static FullPath GetRootDirectory()
8 | {
9 | var directory = FullPath.CurrentDirectory();
10 | while (!Directory.Exists(directory / ".git"))
11 | {
12 | directory = directory.Parent;
13 | }
14 |
15 | return directory;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/Meziantou.DotNet.CodingStandard.Tests/SharedHttpClient.cs:
--------------------------------------------------------------------------------
1 | #nullable enable
2 | namespace Meziantou.DotNet.CodingStandard.Tests;
3 | internal static class SharedHttpClient
4 | {
5 | public static HttpClient Instance { get; } = CreateHttpClient();
6 |
7 | private static HttpClient CreateHttpClient()
8 | {
9 | var socketHandler = new SocketsHttpHandler()
10 | {
11 | PooledConnectionIdleTimeout = TimeSpan.FromMinutes(1),
12 | PooledConnectionLifetime = TimeSpan.FromMinutes(1),
13 | };
14 |
15 | return new HttpClient(new HttpRetryMessageHandler(socketHandler), disposeHandler: true);
16 | }
17 | private sealed class HttpRetryMessageHandler : DelegatingHandler
18 | {
19 | public HttpRetryMessageHandler(HttpMessageHandler handler)
20 | : base(handler)
21 | {
22 | }
23 |
24 | protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
25 | {
26 | const int MaxRetries = 5;
27 | var defaultDelay = TimeSpan.FromMilliseconds(200);
28 | for (var i = 1; ; i++, defaultDelay *= 2)
29 | {
30 | TimeSpan? delayHint = null;
31 | HttpResponseMessage? result = null;
32 |
33 | try
34 | {
35 | result = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
36 | if (!IsLastAttempt(i) && ((int)result.StatusCode >= 500 || result.StatusCode is System.Net.HttpStatusCode.RequestTimeout or System.Net.HttpStatusCode.TooManyRequests))
37 | {
38 | // Use "Retry-After" value, if available. Typically, this is sent with
39 | // either a 503 (Service Unavailable) or 429 (Too Many Requests):
40 | // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
41 |
42 | delayHint = result.Headers.RetryAfter switch
43 | {
44 | { Date: { } date } => date - DateTimeOffset.UtcNow,
45 | { Delta: { } delta } => delta,
46 | _ => null,
47 | };
48 |
49 | result.Dispose();
50 | }
51 | else
52 | {
53 | return result;
54 | }
55 | }
56 | catch (HttpRequestException)
57 | {
58 | result?.Dispose();
59 | if (IsLastAttempt(i))
60 | throw;
61 | }
62 | catch (TaskCanceledException ex) when (ex.CancellationToken != cancellationToken) // catch "The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing"
63 | {
64 | result?.Dispose();
65 | if (IsLastAttempt(i))
66 | throw;
67 | }
68 |
69 | await Task.Delay(delayHint is { } someDelay && someDelay > TimeSpan.Zero ? someDelay : defaultDelay, cancellationToken).ConfigureAwait(false);
70 |
71 | static bool IsLastAttempt(int i) => i >= MaxRetries;
72 | }
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/tools/ConfigFilesGenerator/ConfigFilesGenerator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net9.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 | all
14 | runtime; build; native; contentfiles; analyzers; buildtransitive
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/tools/ConfigFilesGenerator/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using System.Runtime.Loader;
3 | using System.Xml.Linq;
4 | using Meziantou.Framework;
5 | using Microsoft.CodeAnalysis;
6 | using Microsoft.CodeAnalysis.Diagnostics;
7 | using NuGet.Common;
8 | using NuGet.Configuration;
9 | using NuGet.Frameworks;
10 | using NuGet.Packaging.Core;
11 | using NuGet.Packaging.Signing;
12 | using NuGet.Protocol.Core.Types;
13 | using NuGet.Protocol;
14 | using NuGet.Versioning;
15 | using System.Reflection;
16 | using System.Text;
17 | using System.Text.RegularExpressions;
18 |
19 | var rootFolder = GetRootFolderPath();
20 |
21 | var writtenFiles = 0;
22 | var packages = await GetAllReferencedNuGetPackages();
23 | await Parallel.ForEachAsync(packages, async (item, cancellationToken) =>
24 | {
25 | var (packageId, packageVersion) = item;
26 |
27 | Console.WriteLine(packageId + "@" + packageVersion);
28 | var configurationFilePath = rootFolder / "src" / "configuration" / ("Analyzer." + packageId + ".editorconfig");
29 |
30 | var rules = new HashSet();
31 | foreach (var assembly in await GetAnalyzerReferences(packageId, packageVersion))
32 | {
33 | foreach (var type in assembly.GetTypes())
34 | {
35 | if (type.IsAbstract || type.IsInterface)
36 | continue;
37 |
38 | if (!typeof(DiagnosticAnalyzer).IsAssignableFrom(type))
39 | continue;
40 |
41 | var analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(type)!;
42 | foreach (var diagnostic in analyzer.SupportedDiagnostics)
43 | {
44 | rules.Add(new AnalyzerRule(diagnostic.Id, diagnostic.Title.ToString(CultureInfo.InvariantCulture).Trim(), diagnostic.HelpLinkUri, diagnostic.IsEnabledByDefault, diagnostic.DefaultSeverity, diagnostic.IsEnabledByDefault ? diagnostic.DefaultSeverity : null));
45 | }
46 | }
47 | }
48 |
49 | if (rules.Count > 0)
50 | {
51 | var sb = new StringBuilder();
52 | sb.AppendLine("# global_level must be higher than the NET Analyzer files");
53 | sb.AppendLine("is_global = true");
54 | sb.AppendLine("global_level = 0");
55 |
56 | var currentConfiguration = GetConfiguration(configurationFilePath);
57 |
58 | if (currentConfiguration.Unknowns.Length > 0)
59 | {
60 | foreach (var unknown in currentConfiguration.Unknowns)
61 | {
62 | sb.AppendLine(unknown);
63 | }
64 | }
65 | else
66 | {
67 | sb.AppendLine();
68 | }
69 |
70 | foreach (var rule in rules.OrderBy(rule => rule.Id))
71 | {
72 | var currentRuleConfiguration = currentConfiguration.Rules.FirstOrDefault(r => r.Id == rule.Id);
73 | var severity = currentRuleConfiguration != null ? currentRuleConfiguration.Severity : rule.DefaultEffectiveSeverity;
74 |
75 | sb.AppendLine($"# {rule.Id}: {rule.Title}");
76 | if (!string.IsNullOrEmpty(rule.Url))
77 | {
78 | sb.AppendLine($"# Help link: {rule.Url}");
79 | }
80 |
81 | sb.AppendLine($"# Enabled: {rule.Enabled}, Severity: {GetSeverity(rule.DefaultSeverity)}");
82 |
83 | if (currentRuleConfiguration?.Comments.Length > 0)
84 | {
85 | foreach (var comment in currentRuleConfiguration.Comments)
86 | {
87 | sb.AppendLine(comment);
88 | }
89 | }
90 |
91 | sb.AppendLine($"dotnet_diagnostic.{rule.Id}.severity = {GetSeverity(severity)}");
92 | sb.AppendLine();
93 | }
94 |
95 | var text = sb.ToString().ReplaceLineEndings("\n");
96 | if (File.Exists(configurationFilePath))
97 | {
98 | if (File.ReadAllText(configurationFilePath).ReplaceLineEndings("\n") == text)
99 | return;
100 | }
101 |
102 | configurationFilePath.CreateParentDirectory();
103 | await File.WriteAllTextAsync(configurationFilePath, text, cancellationToken);
104 | Interlocked.Increment(ref writtenFiles);
105 |
106 | static string GetSeverity(DiagnosticSeverity? severity)
107 | {
108 | return severity switch
109 | {
110 | null => "none",
111 | DiagnosticSeverity.Hidden => "silent",
112 | DiagnosticSeverity.Info => "suggestion",
113 | DiagnosticSeverity.Warning => "warning",
114 | DiagnosticSeverity.Error => "error",
115 | _ => throw new Exception($"Severity '{severity}' is not supported"),
116 | };
117 | }
118 | }
119 | });
120 |
121 | return writtenFiles;
122 |
123 |
124 | async Task<(string Id, NuGetVersion Version)[]> GetAllReferencedNuGetPackages()
125 | {
126 | var foundPackages = new HashSet();
127 |
128 | var cache = new SourceCacheContext();
129 | var repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json");
130 | var resource = await repository.GetResourceAsync();
131 |
132 | foreach (var package in GetReferencedNuGetPackages())
133 | {
134 | // Find the latest version if no version is specified
135 | var version = package.Version is null ? null : NuGetVersion.Parse(package.Version);
136 | if (version is null)
137 | {
138 | var metadata = await resource.GetMetadataAsync(package.Id, includePrerelease: true, includeUnlisted: false, cache, NullLogger.Instance, CancellationToken.None);
139 | version = metadata.MaxBy(metadata => metadata.Identity.Version)!.Identity.Version;
140 | }
141 |
142 | var packageIdentity = new PackageIdentity(package.Id, version);
143 | await ListAllPackageDependencies(packageIdentity, [repository], NuGetFramework.AnyFramework, cache, NullLogger.Instance, foundPackages, CancellationToken.None);
144 | }
145 |
146 | return foundPackages.Select(p => (p.Id, p.Version)).ToArray();
147 |
148 | static async Task ListAllPackageDependencies(
149 | PackageIdentity package,
150 | IEnumerable repositories,
151 | NuGetFramework framework,
152 | SourceCacheContext cache,
153 | ILogger logger,
154 | HashSet dependencies,
155 | CancellationToken cancellationToken)
156 | {
157 | if (dependencies.Contains(package))
158 | {
159 | return;
160 | }
161 |
162 | foreach (var repository in repositories)
163 | {
164 | var dependencyInfoResource = await repository.GetResourceAsync();
165 | var dependencyInfo = await dependencyInfoResource.ResolvePackage(package, framework, cache, logger, cancellationToken);
166 |
167 | if (dependencyInfo == null)
168 | {
169 | continue;
170 | }
171 |
172 | if (dependencies.Add(dependencyInfo))
173 | {
174 | foreach (var dependency in dependencyInfo.Dependencies)
175 | {
176 | await ListAllPackageDependencies(
177 | new PackageIdentity(dependency.Id, dependency.VersionRange.MinVersion),
178 | repositories,
179 | framework,
180 | cache,
181 | logger,
182 | dependencies,
183 | cancellationToken);
184 | }
185 | }
186 | }
187 | }
188 | }
189 |
190 | IEnumerable<(string Id, string? Version)> GetReferencedNuGetPackages()
191 | {
192 | var nuspecPath = rootFolder / "Meziantou.DotNet.CodingStandard.nuspec";
193 | var document = XDocument.Load(nuspecPath);
194 | var ns = document.Root!.Name.Namespace;
195 | foreach (var value in document.Descendants(ns + "dependency").Select(node => (node.Attribute("id")!.Value, node.Attribute("version")!.Value)))
196 | {
197 | yield return value;
198 | }
199 |
200 | // Add analyzers from the .NET SDK
201 | foreach (var package in new[] { "Microsoft.CodeAnalysis.NetAnalyzers", /* "Microsoft.CodeAnalysis.CSharp.CodeStyle" */ })
202 | {
203 | yield return (package, null);
204 | }
205 | }
206 |
207 | static FullPath GetRootFolderPath()
208 | {
209 | var path = FullPath.CurrentDirectory();
210 | while (!path.IsEmpty)
211 | {
212 | if (Directory.Exists(path / ".git"))
213 | return path;
214 |
215 | path = path.Parent;
216 | }
217 |
218 | if (path.IsEmpty)
219 | throw new InvalidOperationException("Cannot find the root folder");
220 |
221 | return path;
222 | }
223 |
224 | static async Task GetAnalyzerReferences(string packageId, NuGetVersion version)
225 | {
226 | ILogger logger = NullLogger.Instance;
227 | CancellationToken cancellationToken = CancellationToken.None;
228 |
229 | var settings = Settings.LoadDefaultSettings(null);
230 | var globalPackagesFolder = SettingsUtility.GetGlobalPackagesFolder(settings);
231 | var source = "https://api.nuget.org/v3/index.json";
232 |
233 | var cache = new SourceCacheContext();
234 | var repository = Repository.Factory.GetCoreV3(source);
235 | var resource = await repository.GetResourceAsync();
236 |
237 | var package = GlobalPackagesFolderUtility.GetPackage(new PackageIdentity(packageId, version), globalPackagesFolder);
238 | if (package is null || package.Status is DownloadResourceResultStatus.NotFound)
239 | {
240 | // Download the package
241 | using var packageStream = new MemoryStream();
242 | await resource.CopyNupkgToStreamAsync(
243 | packageId,
244 | version,
245 | packageStream,
246 | cache,
247 | logger,
248 | cancellationToken);
249 |
250 | packageStream.Seek(0, SeekOrigin.Begin);
251 |
252 | // Add it to the global package folder
253 | package = await GlobalPackagesFolderUtility.AddPackageAsync(
254 | source,
255 | new PackageIdentity(packageId, version),
256 | packageStream,
257 | globalPackagesFolder,
258 | parentId: Guid.Empty,
259 | ClientPolicyContext.GetClientPolicy(settings, logger),
260 | logger,
261 | cancellationToken);
262 | }
263 |
264 | var result = new List();
265 | var groups = package.PackageReader.GetFiles("analyzers").GroupBy(Path.GetDirectoryName).ToArray();
266 | foreach (var group in groups)
267 | {
268 | var context = new AssemblyLoadContext(null);
269 | foreach (var file in group)
270 | {
271 | try
272 | {
273 | using var stream = package.PackageReader.GetStream(file);
274 | result.Add(context.LoadFromStream(stream));
275 | }
276 | catch (Exception ex)
277 | {
278 | Console.WriteLine(ex);
279 | }
280 | }
281 | }
282 |
283 | return result.ToArray();
284 | }
285 |
286 | static (AnalyzerConfiguration[] Rules, string[] Unknowns) GetConfiguration(FullPath editorconfig)
287 | {
288 | var rules = new List();
289 | var unknowns = new List();
290 |
291 | var currentComment = new List();
292 | try
293 | {
294 | var lines = File.ReadAllLines(editorconfig);
295 |
296 | foreach (var line in lines)
297 | {
298 | try
299 | {
300 | if (line.StartsWith('#'))
301 | {
302 | if (line.StartsWith("# Enabled: ", StringComparison.Ordinal))
303 | continue;
304 |
305 | if (line.StartsWith("# Default severity: ", StringComparison.Ordinal))
306 | continue;
307 |
308 | if (line.StartsWith("# Help link: ", StringComparison.Ordinal))
309 | continue;
310 |
311 | currentComment.Add(line);
312 | continue;
313 | }
314 |
315 | if (line.StartsWith("is_global", StringComparison.Ordinal))
316 | continue;
317 |
318 | if (line.StartsWith("global_level", StringComparison.Ordinal))
319 | continue;
320 |
321 | var match = Regex.Match(line, @"^dotnet_diagnostic\.(?[a-zA-Z0-9]+).severity\s*=\s*(?[a-z]+)");
322 | if (match.Success)
323 | {
324 | DiagnosticSeverity? diagnosticSeverity = null;
325 | var severityValue = match.Groups["Severity"].Value;
326 | if (severityValue == "silent")
327 | {
328 | diagnosticSeverity = DiagnosticSeverity.Hidden;
329 | }
330 | else if (severityValue == "suggestion")
331 | {
332 | diagnosticSeverity = DiagnosticSeverity.Info;
333 | }
334 | else if (Enum.TryParse(severityValue, ignoreCase: true, out var severity))
335 | {
336 | diagnosticSeverity = severity;
337 | }
338 |
339 | rules.Add(new AnalyzerConfiguration(match.Groups["RuleId"].Value, currentComment.Skip(1).ToArray(), diagnosticSeverity));
340 | }
341 | else
342 | {
343 | foreach (var comment in currentComment)
344 | {
345 | unknowns.Add(comment);
346 | }
347 |
348 | if (rules.Count == 0 || !string.IsNullOrEmpty(line))
349 | {
350 | unknowns.Add(line);
351 | }
352 | }
353 |
354 | }
355 | finally
356 | {
357 | if (!line.StartsWith('#'))
358 | {
359 | currentComment.Clear();
360 | }
361 | }
362 | }
363 | }
364 | catch
365 | {
366 | }
367 |
368 | return (rules.ToArray(), unknowns.ToArray());
369 | }
370 |
371 | sealed record AnalyzerConfiguration(string Id, string[] Comments, DiagnosticSeverity? Severity);
372 |
373 | sealed record AnalyzerRule(string Id, string Title, string? Url, bool Enabled, DiagnosticSeverity DefaultSeverity, DiagnosticSeverity? DefaultEffectiveSeverity);
--------------------------------------------------------------------------------