Skip to main content
Version: 2.25 (dev)

scalafix


scalafix (https://scalacenter.github.io/scalafix/)

Backend: pants.backend.experimental.scala.lint.scalafix

Config section: [scalafix]

Basic options

skip

--[no-]scalafix-skip
PANTS_SCALAFIX_SKIP
pants.toml
[scalafix]
skip = <bool>
default: False

If true, don't use scalafix when running pants fix and pants lint.

Advanced options

artifacts

--scalafix-artifacts="['<str>', '<str>', ...]"
PANTS_SCALAFIX_ARTIFACTS
pants.toml
[scalafix]
artifacts = [
'<str>',
'<str>',
...,
]
default:
[
  "ch.epfl.scala:scalafix-cli_2.13.12:{version}"
]

Artifact requirements for this tool using specified as either the address of a jvm_artifact target or, alternatively, as a colon-separated Maven coordinates (e.g., group:name:version). For Maven coordinates, the string {version} version will be substituted with the value of the [scalafix].version option.

config_file_name

--scalafix-config-file-name=<str>
PANTS_SCALAFIX_CONFIG_FILE_NAME
pants.toml
[scalafix]
config_file_name = <str>
default: .scalafix.conf

Name of a config file understood by scalafix (https://scalacenter.github.io/scalafix/docs/users/configuration.html). The plugin will search the ancestors of each directory in which Scala files are found for a config file of this name.

jvm_options

--scalafix-jvm-options="['<str>', '<str>', ...]"
PANTS_SCALAFIX_JVM_OPTIONS
pants.toml
[scalafix]
jvm_options = [
'<str>',
'<str>',
...,
]
default: []

List of JVM options to pass to scalafix JVM processes.

Options set here will be added to those set in [jvm].global_options. Please check the documentation for the jvm subsystem to see what values are accepted here.

lockfile

--scalafix-lockfile=<str>
PANTS_SCALAFIX_LOCKFILE
pants.toml
[scalafix]
lockfile = <str>
default: <default>

Path to a lockfile used for installing the tool.

Set to the string <default> to use a lockfile provided by Pants, so long as you have not changed the --version option. See https://github.com/pantsbuild/pants/blob/release_2.24.0.dev3/src/python/pants/backend/scala/lint/scalafix/scalafix.default.lockfile.txt for the default lockfile contents.

To use a custom lockfile, set this option to a file path relative to the build root, then run pants generate-lockfiles --resolve=scalafix.

orphan_files_behavior

--scalafix-orphan-files-behavior=<OrphanFilepathConfigBehavior>
PANTS_SCALAFIX_ORPHAN_FILES_BEHAVIOR
pants.toml
[scalafix]
orphan_files_behavior = <OrphanFilepathConfigBehavior>
one of: ignore, error, warn
default: error

Whether to ignore, error or show a warning when files are found that are not covered by the config file provided in [scalafix].config_file_name setting.

rule_targets

--scalafix-rule-targets="['<str>', '<str>', ...]"
PANTS_SCALAFIX_RULE_TARGETS
pants.toml
[scalafix]
rule_targets = [
'<str>',
'<str>',
...,
]
default: []

List of targets providing additional Scalafix rules.

semantic_rules

--[no-]scalafix-semantic-rules
PANTS_SCALAFIX_SEMANTIC_RULES
pants.toml
[scalafix]
semantic_rules = <bool>
default: True

Whether semantic rules are enabled or not.

Using semantic rules requires the usage of the semanticdb-scalac plugin and will trigger compilation of the source code before running scalafix on the sources.

version

--scalafix-version=<str>
PANTS_SCALAFIX_VERSION
pants.toml
[scalafix]
version = <str>
default: 0.11.1

Version string for the tool. This is available for substitution in the [scalafix].artifacts option by including the string {version}.

Deprecated options

None

None