Skip to content

Fix

invoke_tasklib.fix

Composite task that runs the fixers.

invoke_tasklib.fix.NAMESPACE module-attribute

NAMESPACE = 'fix'

The name of the namespace of the tasks of this module.

invoke_tasklib.fix.all_

all_(
    c: Context,
    *,
    keep_going: bool = False,
    only: str | None = None,
    skip: str | None = None,
) -> None

Fix the lint and format issues of the project.

The steps are the ones of tasklib.fix.tasks (by default lint, format-python and format-docstrings), run in that order: the lint fixes come first, so that the formatting has the last word on the layout. The other step is shell. The steps modify files; check.all is the read-only counterpart. By default the first failure stops the task; with keep_going every step is run and the failed ones are listed at the end.

Before any step is run, the programs that the selected steps need (the programs of _STEPS) are looked up and all the missing ones are reported at once, with the code 127 and nothing run. With keep_going, only the steps that miss a tool are not run: they are reported as failed, with the missing tools as the reason.

Parameters:

Name Type Description Default
c Context

The invoke context.

required
keep_going bool

If True, run all the steps even if one fails.

False
only str | None

Comma-separated steps to run instead of the configured ones.

None
skip str | None

Comma-separated steps to leave out.

None

Raises:

Type Description
Exit

If a name of only or skip is unknown, if a tool of the selected steps is missing (code 127), or if keep_going is set and a step failed.

UnexpectedExit

If a step fails and keep_going is not set.