dotnet/roslyn

IDE0040 'Accessibility modifiers required' should be configurable to ignore partial containing classes

Aberta

#52.904 aberto em 25 de abr. de 2021

 (12 comentários) (9 reações) (0 responsável)C# (4.257 forks)batch import
Area-IDEConcept-Continuous ImprovementFeature - IDE0040help wanted

Métricas do repositório

Stars
 (20.414 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

I don't like duplicating the accessibility modifiers on the second file, but out of the box now, .NET 5 puts a suggestion annotation in the code and the error list to do so:

internal sealed partial class A // Or some other modifiers
{
    // ...
}
// ℹ IDE0040 Accessibility modifiers required
//            ↓
partial class A
{
    private sealed class B
    {
        // ...
    }
}

Could IDE0040 please skip analyzing classes that are only specifying the minimal amount necessary to declare the nested type? If not, could this be made configurable?

Guia do colaborador