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

indent-error-flow reports a false positive #19

Closed
mgechev opened this issue Jun 12, 2018 · 2 comments
Closed

indent-error-flow reports a false positive #19

mgechev opened this issue Jun 12, 2018 · 2 comments
Labels

Comments

@mgechev
Copy link
Owner

mgechev commented Jun 12, 2018

Describe the bug

indent-error-flow gives false positive for:

func h(f func() bool, x int) string {
	if err == author.ErrCourseNotFound {
		return
	} else if err == author.ErrCourseAccess {
		// side effect
	} else if err == author.AnotherError {
		return "okay"
	} else {
		// side effect
	}
}

To Reproduce
Steps to reproduce the behavior:

  1. I updated revive go get -u github.com/mgechev/revive
  2. I run the rule indent-error-flow
  3. I got a warning if block ends with a return statement, so drop this else and outdent its block

Expected behavior

Should not get a warning in the case above because of the else if statements.

@mgechev mgechev added the bug label Jun 12, 2018
@mgechev
Copy link
Owner Author

mgechev commented Jun 12, 2018

@chavacava let me know if you want to take this one.

@chavacava
Copy link
Collaborator

Hi, please take a look to the corresponding pull request.

@mgechev mgechev closed this as completed Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants