Skip to content

if_switch_linter false positive when testing == "" #2835

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

Open
MichaelChirico opened this issue Mar 14, 2025 · 0 comments
Open

if_switch_linter false positive when testing == "" #2835

MichaelChirico opened this issue Mar 14, 2025 · 0 comments
Labels
false-positive code that shouldn't lint, but does

Comments

@MichaelChirico
Copy link
Collaborator

As seen in {DBItest}:

https://github.com/r-dbi/DBItest/blob/00060442200eb230350a308c37e30f797a371f95/R/spec-meta-bind-.R#L136-L153

if (kind == "") {
  ...
} else if (kind == "1") {
  ...
} else if (kind == "name") {
  ...
} else {
  ...
}

This has no switch() equivalent because "" would be a 0-length variable name.

@MichaelChirico MichaelChirico added the false-positive code that shouldn't lint, but does label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive code that shouldn't lint, but does
Projects
None yet
Development

No branches or pull requests

1 participant