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

Add rule for omitting empty enum with associated value arguments #1425

Closed
keith opened this issue Apr 10, 2017 · 3 comments
Closed

Add rule for omitting empty enum with associated value arguments #1425

keith opened this issue Apr 10, 2017 · 3 comments
Labels
rule-request Requests for a new rules.

Comments

@keith
Copy link
Collaborator

keith commented Apr 10, 2017

Currently you can do this:

enum Foo {
    case bar(String)
}
switch foo {
case .bar(_):
    break
}

I think we should add rule to have people remove (_). Note it can also be (_, _).

I've added this regex on our codebase with no false positives: "\([,\s*_]+\)"

@keith keith added the rule-request Requests for a new rules. label Apr 10, 2017
@mortenholmgaard
Copy link

I have a method in my enum just like this:
func isCurrent() -> Bool { ... }
And when called like Environment.dev.isCurrent() I get this lint warning in this line which must be wrong.

@SimplyDanny
Copy link
Collaborator

You should open an own issue for your example with a more detailed description, @mortenholmgaard. Herein, it will probably be missed.

@mortenholmgaard
Copy link

Ups, I just saw that I didn't have the latest version and this seems to be fixed in that version - sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

3 participants