Lint
invoke_tasklib.lint ¶
Lint tasks (lint.*).
The Python code is linted with ruff, the text with codespell, and
lint.pre-commit runs the pre-commit hooks of the project.
Naming convention: check_<target> tasks are read-only;
fix_<target> tasks modify files in place.
invoke_tasklib.lint.check_python ¶
check_python(
c: Context,
*,
output_format: str | None = None,
args: str | None = None,
paths: str | None = None,
) -> None
Check code linting with ruff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Context
|
The invoke context. |
required |
output_format
|
str | None
|
The |
None
|
args
|
str | None
|
Extra arguments passed to ruff, e.g. |
None
|
paths
|
str | None
|
The files or directories to check instead of the whole
project ( |
None
|
invoke_tasklib.lint.check_spelling ¶
check_spelling(
c: Context,
*,
args: str | None = None,
paths: str | None = None,
) -> None
Check the spelling with codespell.
The configuration of codespell is read from the project
(pyproject.toml). The files are not modified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Context
|
The invoke context. |
required |
args
|
str | None
|
Extra arguments passed to codespell. |
None
|
paths
|
str | None
|
The files or directories to check instead of the whole
project ( |
None
|
invoke_tasklib.lint.fix_python ¶
fix_python(
c: Context,
*,
args: str | None = None,
paths: str | None = None,
) -> None
Fix auto-fixable linting issues in place with ruff.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Context
|
The invoke context. |
required |
args
|
str | None
|
Extra arguments passed to ruff, e.g. |
None
|
paths
|
str | None
|
The files or directories to fix instead of the whole
project ( |
None
|
Note
This modifies files in place. Ensure your work is committed before running this task.
invoke_tasklib.lint.pre_commit ¶
pre_commit(c: Context, *, args: str | None = None) -> None
Run all the pre-commit hooks on all the files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
Context
|
The invoke context. |
required |
args
|
str | None
|
Extra arguments passed to |
None
|
Note
The hooks may modify files in place.