Skip to main content
Version: 2.20

code_quality_tool


Configure a runnable to use as a linter, fixer or formatter

Example BUILD file:

code_quality_tool(
runnable=":flake8_req",
execution_dependencies=[":config_file"],
file_glob_include=["**/*.py"],
)

Backend: pants.backend.experimental.adhoc


file_glob_include

Iterable[str]
required

Globs that identify files that can be processed by this tool

A file matching any of the supplied globs is eligible for processing. Example: ["**/*.py"]

runnable

str
required

Address to a target that can be invoked by the run goal (and does not set run_in_sandbox_behavior=NOT_SUPPORTED). This will be executed along with any arguments specified by args, in a sandbox with that target's transitive dependencies, along with the transitive dependencies specified by execution_dependencies.

args

Iterable[str] | None
default: ()

Extra arguments to pass into the runnable field before the list of source files

description

str | None
default: None

A human-readable description of the target.

Use pants list --documented :: to see all targets with descriptions.

execution_dependencies

Iterable[str] | None
default: None

Additional dependencies that need to be available when running the tool. Typically used to point to config files.

file_glob_exclude

Iterable[str] | None
default: ()

Globs matching files that should not be processed by this tool

runnable_dependencies

Iterable[str] | None
default: None

The runnable dependencies for this command.

Dependencies specified here are those required to exist on the PATH to make the command complete successfully (interpreters specified in a #! command, etc). Note that these dependencies will be made available on the PATH with the name of the target.

See also execution_dependencies.

tags

Iterable[str] | None
default: None

Arbitrary strings to describe a target.

For example, you may tag some test targets with 'integration_test' so that you could run pants --tag='integration_test' test :: to only run on targets with that tag.