question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SA1025 - Strict on single return statement

See original GitHub issue

SA1025 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sharwellcommented, Aug 2, 2017

Ah, that makes more sense. This looks like a duplicate of #2252.

0reactions
danielbecroftcommented, Aug 1, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found