Use Nullable Type Attributes for Properties/Fields where Initialization is Outside the Constructor
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先查看 issue 中的 nullable-analysis 示例,尤其是 TestContext 和计算得到的 Name 属性。定位 repository 中代码分析规则的入口点以及现有的 pragma 相关行为;完成的标准是:规则针对构造函数之外的初始化提出 nullable 属性,而不是生成 pragma。
由索引模型根据 Issue 内容生成。
描述
Given properties that the compiler can't detect initialization for, such as MSTest's TestContext or a calculated Name property that splits the assignment to FirstName and LastName, use nullable attributes.
Examples:
[DisallowNull][NotNull]
public TestContext? TestContext {get;set;}
and
Person(string name) { Name = name; }
[DisallowNull][NotNull]
public string? FirstName {get;set;}
[DisallowNull][NotNull]
public string? FirstName {get;set;}
public string Name
{
get => $"{FirstName} {LastName}";
set => { ... }
}
Proposal:
Create a code analysis rule that adds the attributes rather than creates generates a pragma.
- 主要语言
- C#
- 星标
- 12
- 派生
- 16
- 平均合并
- 2 分钟
- 30 天内合并 PR
- 10
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
IntelliTect/CodingGuidelines 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 25/100
IntelliTect/CodingGuidelines#290 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 45/100
IntelliTect/CodingGuidelines#253 ·
维护者通常 1 天内回复
-
Review naming recommendation for fields可能重新可做 @MarkMichaelis 于 1319 天前认领,目前没有进行中的 PR。 未关闭.editorconfig C# coding guidelines proposal
IntelliTect/CodingGuidelines#249 · 6 条评论 · 1 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
-
analyzer C# coding guidelines proposal
难度 5/5 一周以上 新手友好度 35/100
IntelliTect/CodingGuidelines#231 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 35/100
IntelliTect/CodingGuidelines#230 ·
维护者通常 1 天内回复
查看 IntelliTect/CodingGuidelines 的全部 Issue
相似的 Issue
-
area-ai untriaged
难度 2/5 1-3 小时 新手友好度 85/100
dotnet/extensions#7790 ·
维护者通常 1 天内回复
-
P2 testing
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/runtime#134766 · 3 条评论 ·
维护者通常 1 天内回复
-
0 - Backlog Bug
难度 2/5 1-3 小时 新手友好度 88/100
BrighterCommand/Brighter#4444 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复