checks.linting.LintingCheck

checks.linting.LintingCheck()

Run linting tools on the package.

Executes a configurable linting tool to check code quality and style. Supports ruff (default), flake8, and pylint.

Attributes

name :

The check identifier (“linting”).

description :

Human-readable description of this check.

SUPPORTED_TOOLS :

List of supported linting tools.

Configuration Options

tool (str): Linter to use (“ruff”, “flake8”, or “pylint”). Defaults to “ruff”. args (list[str]): Additional arguments to pass to the linter.

Examples

Run linting with default settings (ruff):

>>> from pathlib import Path
>>> check = LintingCheck()
>>> result = check.run(Path("."), {"enabled": True})
>>> result.name
'linting'

Configure to use flake8:

>>> config = {"enabled": True, "tool": "flake8"}
>>> result = check.run(Path("."), config)

Pass additional ruff arguments:

>>> config = {"enabled": True, "args": ["--select", "E,W"]}
>>> result = check.run(Path("."), config)

Methods

Name Description
run Run linting check on the package.

run

checks.linting.LintingCheck.run(package_path, config)

Run linting check on the package.

Executes the configured linting tool and collects any issues found. Issues are reported in the result details (limited to first 10).

Parameters

package_path : Path

Path to the package directory to lint.

config : dict[str, Any]

Configuration dictionary with options: - tool (str): “ruff”, “flake8”, or “pylint” (default: “ruff”) - args (list[str]): Additional arguments for the linter

Returns

: CheckResult

A CheckResult with:

: CheckResult
  • OK status if no linting issues found
: CheckResult
  • WARNING status if linting issues found
: CheckResult
  • ERROR status if linter fails or unsupported tool specified
: CheckResult
  • SKIPPED status if the linting tool is not installed