dotnet/aspnetcore
在 GitHub 查看Analyzers API1000 and API1001 should trigger on conditional returns
Open
#33,105 创建于 2021年5月28日
analyzerarea-mvcfeature-openapigood first issuehelp wanted
仓库指标
- Star
- (37,933 star)
- PR 合并指标
- (平均合并 16天 9小时) (30 天内合并 258 个 PR)
描述
Describe the solution you'd like
Analyzers API1000 and API1001 should trigger on returns (or expression-bodied methods) with conditional expressions.
Additional context
public ActionResult<object> OopsUndocumentedIf(int id)
{
if (id == 0)
{
return NotFound(); // API1000
}
return Ok(new object());
}
public ActionResult<object> OopsUndocumentedConditional(int id)
{
return id == 0 ? NotFound() : Ok(new object()); // No API1000
}