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: overriden declaration in extension #1884

Closed
marcelofabri opened this Issue Oct 5, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@marcelofabri
Collaborator

marcelofabri commented Oct 5, 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.

Adding override for Swift-only declarations is already not possible. It's only possible for @objc declarations.

From Apple's Programming with Objective-C

Because the methods declared in a category are added to an existing class, you need to be very careful about method names.

If the name of a method declared in a category is the same as a method in the original class, or a method in another category on the same class (or even a superclass), the behavior is undefined as to which method implementation is used at runtime.

  1. Provide several examples of what would and wouldn't trigger violations.
// should trigger
extension Foo {
  override var bar: String { return "" }

  override func baz() {}
}
  1. Should the rule be configurable, if so what parameters should be configurable?

Just severity.

  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.

I think it should be enabled by default, but I'm afraid that this might cause a lot of violations that are not easily fixed.


I have an initial implementation for this already, I just need some time to clean it up.

@marcelofabri

This comment has been minimized.

Show comment
Hide comment
@marcelofabri

marcelofabri Oct 5, 2017

Collaborator

cc @AliSoftware who originally pitched this idea

Collaborator

marcelofabri commented Oct 5, 2017

cc @AliSoftware who originally pitched this idea

@AliSoftware

This comment has been minimized.

Show comment
Hide comment
@AliSoftware

AliSoftware Oct 5, 2017

Contributor

❤️

Contributor

AliSoftware commented Oct 5, 2017

❤️

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Oct 5, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Oct 5, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Oct 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment