SA1025 - Strict on single return statement
See original GitHub issueSA1025 reports the following as a failure (when it passed in StyleCop Classic):
if (condition) return true;
It would be good if this condition/structure could be added as an exception for SA1025. I couldn’t find it listed in KnownChanges.md as a difference.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Could a setting be considered for SA1501/SA1503 to relax ...
When the body of an if statement consists of a single jump statement (e.g. return, throw, break, continue) we allow that statement without ......
Read more >Should a function have only one return statement?
I agree with this point of view and only strict structured programming purists adhere to single return statements per function.
Read more >The Single Return Law - anthonysteele.github.io
It is sometimes said that a method should have only one return statement (i.e. one exit point) and that to code using more...
Read more >Multiple or single return statement? - Using Swift
I would like to know what is the preferred way to return a value in a function / computed variable (single / multiple...
Read more >Is it valid for a render to have more than one return ...
Answer. Yes, this is valid. Each return statement is nested inside of an if or else code block, meaning that only one of...
Read more >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 FreeTop 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
Top GitHub Comments
Ah, that makes more sense. This looks like a duplicate of #2252.
Sorry @sharwell - I must have written the wrong number in the heading, then assumed that that was correct. The warningis being raised under SA1501 (statement with opening/closing braces must not be on a single line) not SA1025.