Scalafix

Scalafix

  • User guide
  • Developer guide
  • Browse sources
  • GitHub

›Rules

Usage

  • Installation
  • Configuration
  • Suppressing rules

Rules

  • Built-in rules
  • DisableSyntax
  • ExplicitResultTypes
  • LeakingImplicitClassVal
  • NoAutoTupling
  • NoValInForComprehension
  • ProcedureSyntax
  • RedundantSyntax
  • RemoveUnused
  • Using external rules
  • Community rules

Misc

  • Related projects
Edit

ProcedureSyntax

"Procedure syntax" is a deprecated Scala feature that allows methods to leave out the result type and assignment character =. For example,

def debug { println("debug") }

This rule replaces procedure syntax with an explicit : Unit result type for both method implementations and abstract declaration.

// before: procedure syntax
def main(args: Seq[String]) { println("Hello world!") }
trait A { def doSomething }

// after: regular syntax
def main(args: Seq[String]): Unit = { println("Hello world!") }
trait A { def doSomething: Unit }

This syntax no longer exists in Scala 3 and therefore this rule only makes sense in Scala 2. You need to remove ProcedureSyntax from .scalafix.conf for Scala 3 projects.

← NoValInForComprehensionRedundantSyntax →
Scalafix
Docs
Get startedRulesExtend Scalafix
Community
Chat on DiscordDiscuss on Scala Users
More
GitHub
Copyright © 2023 Scala Center