checks.formatting.FormattingCheck

checks.formatting.FormattingCheck()

Check code formatting without modifying files.

Methods

Name Description
run Run formatting check.

run

checks.formatting.FormattingCheck.run(package_path, config)

Run formatting check.

The formatter defaults to "auto": the one the package has configured, which is ruff for a [tool.ruff.format] table or a [format] section in ruff.toml, and black for [tool.black]. A package that has not opted into a formatter is SKIPPED rather than being held to one tool’s default style (pyOpenSci does not mandate a specific formatter). A ruff configuration without a format section is no opt-in. When pyproject.toml could not be read and no other file configures a formatter, the skip reason is “prerequisite-failed”, because the metadata check reports that file. An explicit tool always runs. Also supports args (list[str]) and timeout (seconds, default 120). A formatter that is installed but could not run is a WARNING.