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

S1017: don't trigger if there's an "else if" branch #1541

Closed
wants to merge 1 commit into from

Conversation

arp242
Copy link
Contributor

@arp242 arp242 commented May 25, 2024

This generally makes code less clear; e.g. the "fixed" version for the added test would be:

if strings.HasPrefix(data, "\xff\xfe") {
	data = data[2:]
} else {
	data = strings.TrimPrefix("\xef\xbb\xbf")
}

It already skipped cases with an "else" branch.

Fixes #1447

This generally makes code less clear; e.g. the "fixed" version for the
added test would be:

	if strings.HasPrefix(data, "\xff\xfe") {
		data = data[2:]
	} else {
		data = strings.TrimPrefix("\xef\xbb\xbf")
	}

It already skipped cases with an "else" branch.

Fixes dominikh#1447
@dominikh dominikh closed this in 871dee4 Jun 1, 2024
@arp242 arp242 deleted the s1017 branch June 1, 2024 18:53
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S1017: diagnostics can be confusing for else if, and may make code less consistent
2 participants