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

Closed
2 tasks done
marcelofabri opened this issue Oct 5, 2017 · 2 comments
Closed
2 tasks done

Rule request: overriden declaration in extension #1884

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

Comments

@marcelofabri
Copy link
Collaborator

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 marcelofabri added the rule-request Requests for a new rules. label Oct 5, 2017
@marcelofabri
Copy link
Collaborator Author

cc @AliSoftware who originally pitched this idea

@AliSoftware
Copy link
Contributor

❤️

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