check_hook#
Contract for transformations run by check-dev-files.
- class FileSet(paths: tuple[Path, ...] = (), directories: tuple[Path, ...] = (), patterns: tuple[str, ...] = ())[source]#
Bases:
objectPaths whose staged modification should activate a check hook.
Directories match every file below them. Patterns are regular-expression alternatives for path families that cannot be expressed as one exact path.
- classmethod create(*paths: Path | str, directories: ExplicitCollection[Path | str] = (), patterns: ExplicitCollection[str] = ()) Self[source]#
- class CheckContext(is_python_repo: bool, has_notebooks: bool, doc_apt_packages: list[str], environment_variables: dict[str, str])[source]#
Bases:
objectRepository properties that are derived once and shared by every check.
- Check#
A policy transformation that shares a session, arguments, and check context.
alias of
Callable[[Session,Arguments,CheckContext],None]
- class CheckHook(group: ~typing.Literal['python', 'github', 'env', 'nb', 'format', 'repo'], files: ~compwa_policy.utilities.check_hook.FileSet, run: ~collections.abc.Callable[[~compwa_policy.utilities.session.Session, ~compwa_policy.Arguments, ~compwa_policy.utilities.check_hook.CheckContext], None], enabled: ~collections.abc.Callable[[~compwa_policy.Arguments, ~compwa_policy.utilities.check_hook.CheckContext], bool] = <function _always_enabled>)[source]#
Bases:
objectOne policy transformation together with its dispatch metadata.
- check_hook(*, group: Group, paths: ExplicitCollection[Path | str] = (), directories: ExplicitCollection[Path | str] = (), patterns: ExplicitCollection[str] = (), enabled: Callable[[Arguments, CheckContext], bool] = <function _always_enabled>) Callable[[Check], CheckHook][source]#
Attach dispatch and trigger metadata to a
checkfunction.