Analyzers API1000 and API1001 should trigger on conditional returns
See original GitHub issueDescribe 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
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yup - it was straight rewrite without adding new features. If you’d like to extend it further, we’d be happy to accept a PR for it.
@Youssef1313 the code was rewritten to use operations instead of syntax, but conditional returns were not handled as far as I can see. The new code is still examining the return for method calls and object creation, not for conditionals.