Base Hook Definition

Abstract base functionality, to be extended by individual hooks.

class hooks.utils.hook.Hook(argv: Optional[Sequence[str]] = None)

Abstract base class to be extended by individual hooks.

args

the arguments available to a hook - filenames is provided by default to access the names of files which pre-commit wants our hook to check.

add_arg(*args, **kwargs)

Adds a new argument to the hook, which can then be accessed through the args field in your pre-commit configuration.

abstract run() int

Hook application - this must return 0 if the hook passes, or 1 if it fails.