This rule checks, if variables are named in one of the cases that you have defined in the config.
AllowVariableCases.allowedCases can be defined as an array containing:
camelCase
snake_case
PascalCase
UPPERCASE
(also allows underscores likeUPPER_CASE
)
Default is [camelCase]
.
You can define multiple cases, that are allowed. For example [camelCase, PascalCase]
.
lowercase
is also recognized, but is allowed with camelCase or snake_case.
Configure the rule by setting AllowVariableCases.allowedCases = [...]
in your .scalafix.conf
. For example: AllowVariableCases.allowedCases = ["snake_case"]
You can execute scalafix dependency:[email protected]:scalafix-rules:1.0.0
in the sbt shell.
To install the rule for your build update the scalafixDependencies in your build.sbt
for example like this
ThisBuild / scalafixDependencies +=
"de.spaceteams" %% "scalafix-rules" % "1.0.0"
and execute scalafix AllowVariableCases
in the sbt shell.
You can use this rule directly from GitHub by executing scalafix github:spaceteams/scalafix-rules/AllowVariableCases
in the sbt shell.