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

Linter: Method definition shouldn't take an empty argument list #122

Open
nbraud opened this issue Jun 22, 2015 · 3 comments
Open

Linter: Method definition shouldn't take an empty argument list #122

nbraud opened this issue Jun 22, 2015 · 3 comments

Comments

@nbraud
Copy link

nbraud commented Jun 22, 2015

Currenly, code such as the following compiles without warning:

final object Test {
  def method() = 42
}

def method should be used instead of def method().

@nbraud
Copy link
Author

nbraud commented Jun 22, 2015

@iphydf: Confirm we don't want that either?

@iphydf
Copy link
Member

iphydf commented Jun 22, 2015

This is correct, but we do want () for Unit-returning, or actually even for effectful methods (not sure we can enforce that.. maybe we can have a @pure annotation for that, but that's a lot more work to verify). For now, any nullary method returning non-Unit should not have (), any nullary method returning Unit should.

@iphydf
Copy link
Member

iphydf commented Jun 22, 2015

In this particular example, we also check for "public method has explicit type", already checked by Scalastyle, so we don't need to check for that.

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

2 participants