Customizing "Public method must have explicit type"

508 views
Skip to first unread message

Rüdiger Klaehn

unread,
Dec 18, 2014, 9:17:05 AM12/18/14
to scalasty...@googlegroups.com
Hi All,

I am using scalstyle for a new project, and am trying to adapt it to my needs. I noticed that the "Public method must have explicit type" rule is very strict.

For example, it requires a type for local methods, like in

def x : Int = {
  def y = ...
  ...
}

or for methods in private objects, like

sealed trait A

object A {
  class Impl extends A {
    def foo() = ...
  }
}

In both of these cases, the methods are not really public, so requiring a return type is somewhat excessive. Is it possible to switch off the "Public method must have explicit type" messages in these cases (maybe by writing a new rule), or is this too complex?

Cheers,

Rüdiger

Matthew Farwell

unread,
Dec 21, 2014, 12:47:16 PM12/21/14
to scalasty...@googlegroups.com
It is not currently possible to switch off these particular messages.

There is already a github issue for this - https://github.com/scalastyle/scalastyle/issues/48

I agree that it shouldn't pick them up.

Have fun,

Matthew Farwell.

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Scalastyle users".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.
Pour envoyer un message à ce groupe, envoyez un e-mail à l'adresse scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages