For me, I wanted to disable the analyzer for EF Core migration .cs files. Somehow using dotnet_analyzer_diagnostic.severity = none didn't work. I had to use:
.cs
dotnet_analyzer_diagnostic.severity = none
[Migrations/**] generated_code = true
This is documented here.