OptionWhen

com.choreograph.scalafix.OptionWhen
See theOptionWhen companion object
class OptionWhen extends SemanticRule

Rewrites if-then-else expressions with None/Some branches to Option.when calls.

Examples:

  • if condition then None else Some(value) → Option.when(!condition)(value)
  • if condition then Some(value) else None → Option.when(condition)(value)

Attributes

Companion
object
Source
OptionWhen.scala
Graph
Supertypes
class SemanticRule
class Rule
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def fix(using doc: SemanticDocument): Patch

Attributes

Definition Classes
Source
OptionWhen.scala

Inherited methods

Attributes

Inherited from:
Rule
def beforeStart(): Unit

Attributes

Inherited from:
Rule

Attributes

Inherited from:
Rule

Attributes

Inherited from:
Rule

Attributes

Inherited from:
Rule

Attributes

Inherited from:
Rule
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Rule -> Any
Inherited from:
Rule

Attributes

Inherited from:
Rule

Inherited fields

val name: RuleName

Attributes

Inherited from:
Rule