Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: avoid-if-else #39

Open
froodley opened this issue Jan 28, 2018 · 3 comments
Open

New rule: avoid-if-else #39

froodley opened this issue Jan 28, 2018 · 3 comments

Comments

@froodley
Copy link

http://blog.timoxley.com/post/47041269194/avoid-else-return-early

Use of if-else is always unnecessary, and leads to cyclomatic complexity. Other clean code linters (phpmd, golint) enforce this pattern. Would love to have this rule as I have to enforce it manually in my typescript projects right now.

@Glavin001
Copy link
Owner

@Glavin001 Glavin001 changed the title suggestion: avoid-if-else New rule: avoid-if-else Jan 28, 2018
@froodley
Copy link
Author

froodley commented Jan 29, 2018

Such rules are similar but not quite what I need. They only enforce that if the if branch has a return, else is unnecessary. We expressly forbid use of else, period. In SRP code it is a clear code smell.

@Glavin001
Copy link
Owner

Oh I see what you mean now! Pull Requests very welcome! Great idea for a rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants