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

Suggested rule: require override #373

Open
FFdhorkin opened this issue Jun 3, 2020 · 4 comments
Open

Suggested rule: require override #373

FFdhorkin opened this issue Jun 3, 2020 · 4 comments

Comments

@FFdhorkin
Copy link

Suppose you have

trait FooTrait {
    def bar(): Unit
}

class Foo extends FooTrait {
    def bar() = {  }
}

Under this new rule, the above would give an error, but the below would pass

class Foo extends FooTrait {
    override def bar() = {  }
}
@xplosunn
Copy link
Contributor

xplosunn commented Oct 3, 2020

I'd really like to have that rule but I'm not sure if it can be done using scapegoat.

@mccartney
Copy link
Collaborator

I think this is the article by @nrinaudo on the same topic: https://nrinaudo.github.io/scala-best-practices/oop/always_override.html

@nrinaudo
Copy link

nrinaudo commented Oct 5, 2020

I'd personally love to have this, but it's important to realise it's a controversial stance. Many people told me to never use override unless it'd result in a compilation error.

@mccartney
Copy link
Collaborator

Understood. Thanks for chipping in!
I think we can implement that and if someone is against it, they can disable the rule. I bet we have other controversial rules already.

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

No branches or pull requests

4 participants