dotnet/roslyn

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

开放

#52,904 创建于 2021年4月25日

 (12 条评论) (9 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-IDEConcept-Continuous ImprovementFeature - IDE0040help wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

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?

贡献者指南