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

Rule Request: Duplicate Imports #1881

Closed
2 tasks done
jpsim opened this issue Oct 4, 2017 · 2 comments
Closed
2 tasks done

Rule Request: Duplicate Imports #1881

jpsim opened this issue Oct 4, 2017 · 2 comments
Labels
rule-request Requests for a new rules.

Comments

@jpsim
Copy link
Collaborator

jpsim commented Oct 4, 2017

New Issue Checklist

Rule Request

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

Duplicate imports are unnecessary.

  1. Provide several examples of what would and wouldn't trigger violations.
// Should Trigger
import Foundation
import Dispatch
import Foundation

// Should Trigger
import Foundation
import Foundation.NSString

// Should Not Trigger
Import Foundation.NSString
Import Foundation.NSRange
  1. Should the rule be configurable, if so what parameters should be configurable?

Shouldn't be configurable. Either there are duplicates or not.

  1. Should the rule be opt-in or enabled by default? Why?
    See README.md for guidelines on when to mark a
    rule as opt-in.

Enabled by default.

@marcelofabri removing this duplicate import motivated me to write this rule request: https://github.com/realm/SwiftLint/pull/1872/files#diff-71e28580a5fd3b8b3f701a7c8ca9f6a9

There are gotchas around conditional imports, so I suggest we just not count imports in a conditional compilation expression.

@jpsim jpsim added the rule-request Requests for a new rules. label Oct 4, 2017
@marcelofabri
Copy link
Collaborator

Nice, I thought about filling an issue requesting this rule but I completely forgot later.

@marcelofabri
Copy link
Collaborator

Implemented in #2004

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

2 participants