{ "$id": "https://www.schemastore.org/prek.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "prek configuration file format", "type": "object", "properties": { "repos": { "type": "array", "items": { "$ref": "#/definitions/Repo" } }, "default_install_hook_types": { "description": "A list of `--hook-types` which will be used by default when running `prek install`.\nDefault is `[pre-commit]`.", "type": [ "array", "null" ], "items": { "$ref": "#/definitions/HookType" } }, "default_language_version": { "description": "A mapping from language to the default `language_version`.", "type": [ "object", "null" ], "properties": { "bun": { "type": "string" }, "conda": { "type": "string" }, "coursier": { "type": "string" }, "dart": { "type": "string" }, "docker": { "type": "string" }, "docker_image": { "type": "string" }, "dotnet": { "type": "string" }, "fail": { "type": "string" }, "golang": { "type": "string" }, "haskell": { "type": "string" }, "julia": { "type": "string" }, "lua": { "type": "string" }, "node": { "type": "string" }, "perl": { "type": "string" }, "pygrep": { "type": "string" }, "python": { "type": "string" }, "r": { "type": "string" }, "ruby": { "type": "string" }, "rust": { "type": "string" }, "script": { "type": "string" }, "swift": { "type": "string" }, "system": { "type": "string" } }, "additionalProperties": false }, "default_stages": { "description": "A configuration-wide default for the stages property of hooks.\nDefault to all stages.", "type": [ "array", "null" ], "items": { "$ref": "#/definitions/Stage" } }, "files": { "description": "Global file include pattern.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "exclude": { "description": "Global file exclude pattern.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "fail_fast": { "description": "Set to true to have prek stop running hooks after the first failure.\nDefault is false.", "type": [ "boolean", "null" ] }, "minimum_prek_version": { "description": "The minimum version of prek required to run this configuration.", "type": [ "string", "null" ], "default": null }, "orphan": { "description": "Set to true to isolate this project from parent configurations in workspace mode.\nWhen true, files in this project are \"consumed\" by this project and will not be processed\nby parent projects.\nWhen false (default), files in subprojects are processed by both the subproject and\nany parent projects that contain them.", "type": [ "boolean", "null" ] } }, "required": [ "repos" ], "additionalProperties": true, "definitions": { "Repo": { "description": "A repository of hooks, which can be remote, local, meta, or builtin.", "type": "object", "oneOf": [ { "$ref": "#/definitions/RemoteRepo" }, { "$ref": "#/definitions/LocalRepo" }, { "$ref": "#/definitions/MetaRepo" }, { "$ref": "#/definitions/BuiltinRepo" } ] }, "RemoteRepo": { "type": "object", "properties": { "repo": { "description": "Remote repository location. Must not be `local`, `meta`, or `builtin`.", "type": "string", "not": { "enum": [ "local", "meta", "builtin" ] } }, "rev": { "type": "string" }, "hooks": { "type": "array", "items": { "$ref": "#/definitions/RemoteHook" }, "writeOnly": true } }, "required": [ "repo", "rev", "hooks" ], "additionalProperties": true }, "RemoteHook": { "description": "A remote hook in the configuration file.\n\nAll keys in manifest hook dict are valid in a config hook dict, but are optional.", "type": "object", "properties": { "id": { "description": "The id of the hook.", "type": "string" }, "name": { "description": "Override the name of the hook.", "type": [ "string", "null" ] }, "entry": { "description": "Override the entrypoint. Not documented in the official docs but works.", "type": [ "string", "null" ] }, "language": { "description": "Override the language. Not documented in the official docs but works.", "anyOf": [ { "$ref": "#/definitions/Language" }, { "type": "null" } ] }, "priority": { "description": "Priority used by the scheduler to determine ordering and concurrency.\nHooks with the same priority can run in parallel.\n\nThis is only allowed in project config files (e.g. `.pre-commit-config.yaml`).\nIt is not allowed in manifests (e.g. `.pre-commit-hooks.yaml`).", "type": [ "integer", "null" ], "format": "uint32", "minimum": 0 }, "alias": { "description": "Not documented in the official docs.", "type": [ "string", "null" ] }, "files": { "description": "The pattern of files to run on.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "exclude": { "description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "types": { "description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "types_or": { "description": "List of file types to run on (OR).\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "exclude_types": { "description": "List of file types to exclude.\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "additional_dependencies": { "description": "Not documented in the official docs.", "type": [ "array", "null" ], "items": { "type": "string" } }, "args": { "description": "Additional arguments to pass to the hook.", "type": [ "array", "null" ], "items": { "type": "string" } }, "env": { "description": "Environment variables to set for the hook.", "type": [ "object", "null" ], "additionalProperties": { "type": "string" } }, "always_run": { "description": "This hook will run even if there are no matching files.\nDefault is false.", "type": [ "boolean", "null" ] }, "fail_fast": { "description": "If this hook fails, don't run any more hooks.\nDefault is false.", "type": [ "boolean", "null" ] }, "pass_filenames": { "description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.", "type": [ "boolean", "null" ] }, "description": { "description": "A description of the hook. For metadata only.", "type": [ "string", "null" ] }, "language_version": { "description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee .", "type": [ "string", "null" ] }, "log_file": { "description": "Write the output of the hook to a file when the hook fails or verbose is enabled.", "type": [ "string", "null" ] }, "require_serial": { "description": "This hook will execute using a single process instead of in parallel.\nDefault is false.", "type": [ "boolean", "null" ] }, "stages": { "description": "Select which git hook(s) to run for.\nDefault all stages are selected.\nSee .", "type": [ "array", "null" ], "items": { "$ref": "#/definitions/Stage" } }, "verbose": { "description": "Print the output of the hook even if it passes.\nDefault is false.", "type": [ "boolean", "null" ] }, "minimum_prek_version": { "description": "The minimum version of prek required to run this hook.", "type": [ "string", "null" ], "default": null } }, "required": [ "id" ], "additionalProperties": true }, "Language": { "type": "string", "enum": [ "bun", "conda", "coursier", "dart", "docker", "docker_image", "dotnet", "fail", "golang", "haskell", "julia", "lua", "node", "perl", "pygrep", "python", "r", "ruby", "rust", "script", "swift", "system" ] }, "FilePattern": { "description": "A file pattern, either a regex or glob pattern(s).", "oneOf": [ { "description": "A regular expression pattern.", "type": "string" }, { "type": "object", "properties": { "glob": { "oneOf": [ { "description": "A glob pattern.", "type": "string" }, { "description": "A list of glob patterns.", "type": "array", "items": { "type": "string" } } ] } }, "required": [ "glob" ] } ] }, "Stage": { "type": "string", "enum": [ "manual", "commit-msg", "post-checkout", "post-commit", "post-merge", "post-rewrite", "pre-commit", "pre-merge-commit", "pre-push", "pre-rebase", "prepare-commit-msg" ] }, "LocalRepo": { "type": "object", "properties": { "repo": { "description": "Must be `local`.", "type": "string", "const": "local" }, "hooks": { "type": "array", "items": { "$ref": "#/definitions/LocalHook" } } }, "required": [ "repo", "hooks" ], "additionalProperties": true }, "LocalHook": { "description": "A local hook in the configuration file.\n\nThis is similar to `ManifestHook`, but includes config-only fields (like `priority`).", "type": "object", "properties": { "id": { "description": "The id of the hook.", "type": "string" }, "name": { "description": "The name of the hook.", "type": "string" }, "entry": { "description": "The command to run. It can contain arguments that will not be overridden.", "type": "string" }, "language": { "description": "The language of the hook. Tells prek how to install and run the hook.", "allOf": [ { "$ref": "#/definitions/Language" } ] }, "priority": { "description": "Priority used by the scheduler to determine ordering and concurrency.\nHooks with the same priority can run in parallel.", "type": [ "integer", "null" ], "format": "uint32", "minimum": 0 }, "alias": { "description": "Not documented in the official docs.", "type": [ "string", "null" ] }, "files": { "description": "The pattern of files to run on.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "exclude": { "description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "types": { "description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "types_or": { "description": "List of file types to run on (OR).\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "exclude_types": { "description": "List of file types to exclude.\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "additional_dependencies": { "description": "Not documented in the official docs.", "type": [ "array", "null" ], "items": { "type": "string" } }, "args": { "description": "Additional arguments to pass to the hook.", "type": [ "array", "null" ], "items": { "type": "string" } }, "env": { "description": "Environment variables to set for the hook.", "type": [ "object", "null" ], "additionalProperties": { "type": "string" } }, "always_run": { "description": "This hook will run even if there are no matching files.\nDefault is false.", "type": [ "boolean", "null" ] }, "fail_fast": { "description": "If this hook fails, don't run any more hooks.\nDefault is false.", "type": [ "boolean", "null" ] }, "pass_filenames": { "description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.", "type": [ "boolean", "null" ] }, "description": { "description": "A description of the hook. For metadata only.", "type": [ "string", "null" ] }, "language_version": { "description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee .", "type": [ "string", "null" ] }, "log_file": { "description": "Write the output of the hook to a file when the hook fails or verbose is enabled.", "type": [ "string", "null" ] }, "require_serial": { "description": "This hook will execute using a single process instead of in parallel.\nDefault is false.", "type": [ "boolean", "null" ] }, "stages": { "description": "Select which git hook(s) to run for.\nDefault all stages are selected.\nSee .", "type": [ "array", "null" ], "items": { "$ref": "#/definitions/Stage" } }, "verbose": { "description": "Print the output of the hook even if it passes.\nDefault is false.", "type": [ "boolean", "null" ] }, "minimum_prek_version": { "description": "The minimum version of prek required to run this hook.", "type": [ "string", "null" ], "default": null } }, "required": [ "id", "name", "entry", "language" ], "additionalProperties": true }, "MetaRepo": { "type": "object", "properties": { "repo": { "description": "Must be `meta`.", "type": "string", "const": "meta" }, "hooks": { "type": "array", "items": { "$ref": "#/definitions/MetaHook" } } }, "required": [ "repo", "hooks" ], "additionalProperties": true }, "MetaHook": { "description": "A meta hook predefined in prek.", "type": "object", "properties": { "id": { "$ref": "#/definitions/MetaHooks" }, "name": { "description": "Override the name of the hook.", "type": [ "string", "null" ] }, "entry": { "description": "Entry is not allowed for predefined hooks.", "const": false }, "language": { "anyOf": [ { "description": "Language must be `system` for predefined hooks (or omitted).", "type": "string", "enum": [ "system" ] }, { "type": "null" } ] }, "priority": { "description": "Priority used by the scheduler to determine ordering and concurrency.\nHooks with the same priority can run in parallel.\n\nThis is only allowed in project config files (e.g. `.pre-commit-config.yaml`).\nIt is not allowed in manifests (e.g. `.pre-commit-hooks.yaml`).", "type": [ "integer", "null" ], "format": "uint32", "minimum": 0 }, "alias": { "description": "Not documented in the official docs.", "type": [ "string", "null" ] }, "files": { "description": "The pattern of files to run on.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "exclude": { "description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "types": { "description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "types_or": { "description": "List of file types to run on (OR).\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "exclude_types": { "description": "List of file types to exclude.\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "additional_dependencies": { "description": "Not documented in the official docs.", "type": [ "array", "null" ], "items": { "type": "string" } }, "args": { "description": "Additional arguments to pass to the hook.", "type": [ "array", "null" ], "items": { "type": "string" } }, "env": { "description": "Environment variables to set for the hook.", "type": [ "object", "null" ], "additionalProperties": { "type": "string" } }, "always_run": { "description": "This hook will run even if there are no matching files.\nDefault is false.", "type": [ "boolean", "null" ] }, "fail_fast": { "description": "If this hook fails, don't run any more hooks.\nDefault is false.", "type": [ "boolean", "null" ] }, "pass_filenames": { "description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.", "type": [ "boolean", "null" ] }, "description": { "description": "A description of the hook. For metadata only.", "type": [ "string", "null" ] }, "language_version": { "description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee .", "type": [ "string", "null" ] }, "log_file": { "description": "Write the output of the hook to a file when the hook fails or verbose is enabled.", "type": [ "string", "null" ] }, "require_serial": { "description": "This hook will execute using a single process instead of in parallel.\nDefault is false.", "type": [ "boolean", "null" ] }, "stages": { "description": "Select which git hook(s) to run for.\nDefault all stages are selected.\nSee .", "type": [ "array", "null" ], "items": { "$ref": "#/definitions/Stage" } }, "verbose": { "description": "Print the output of the hook even if it passes.\nDefault is false.", "type": [ "boolean", "null" ] }, "minimum_prek_version": { "description": "The minimum version of prek required to run this hook.", "type": [ "string", "null" ], "default": null } }, "required": [ "id" ], "additionalProperties": true }, "MetaHooks": { "type": "string", "enum": [ "check-hooks-apply", "check-useless-excludes", "identity" ] }, "BuiltinRepo": { "type": "object", "properties": { "repo": { "description": "Must be `builtin`.", "type": "string", "const": "builtin" }, "hooks": { "type": "array", "items": { "$ref": "#/definitions/BuiltinHook" } } }, "required": [ "repo", "hooks" ], "additionalProperties": true }, "BuiltinHook": { "description": "A builtin hook predefined in prek.", "type": "object", "properties": { "id": { "$ref": "#/definitions/BuiltinHooks" }, "name": { "description": "Override the name of the hook.", "type": [ "string", "null" ] }, "entry": { "description": "Entry is not allowed for predefined hooks.", "const": false }, "language": { "anyOf": [ { "description": "Language must be `system` for predefined hooks (or omitted).", "type": "string", "enum": [ "system" ] }, { "type": "null" } ] }, "priority": { "description": "Priority used by the scheduler to determine ordering and concurrency.\nHooks with the same priority can run in parallel.\n\nThis is only allowed in project config files (e.g. `.pre-commit-config.yaml`).\nIt is not allowed in manifests (e.g. `.pre-commit-hooks.yaml`).", "type": [ "integer", "null" ], "format": "uint32", "minimum": 0 }, "alias": { "description": "Not documented in the official docs.", "type": [ "string", "null" ] }, "files": { "description": "The pattern of files to run on.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "exclude": { "description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.", "anyOf": [ { "$ref": "#/definitions/FilePattern" }, { "type": "null" } ] }, "types": { "description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "types_or": { "description": "List of file types to run on (OR).\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "exclude_types": { "description": "List of file types to exclude.\nDefault is `[]`.", "type": [ "array", "null" ], "items": { "type": "string" }, "default": null }, "additional_dependencies": { "description": "Not documented in the official docs.", "type": [ "array", "null" ], "items": { "type": "string" } }, "args": { "description": "Additional arguments to pass to the hook.", "type": [ "array", "null" ], "items": { "type": "string" } }, "env": { "description": "Environment variables to set for the hook.", "type": [ "object", "null" ], "additionalProperties": { "type": "string" } }, "always_run": { "description": "This hook will run even if there are no matching files.\nDefault is false.", "type": [ "boolean", "null" ] }, "fail_fast": { "description": "If this hook fails, don't run any more hooks.\nDefault is false.", "type": [ "boolean", "null" ] }, "pass_filenames": { "description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.", "type": [ "boolean", "null" ] }, "description": { "description": "A description of the hook. For metadata only.", "type": [ "string", "null" ] }, "language_version": { "description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee .", "type": [ "string", "null" ] }, "log_file": { "description": "Write the output of the hook to a file when the hook fails or verbose is enabled.", "type": [ "string", "null" ] }, "require_serial": { "description": "This hook will execute using a single process instead of in parallel.\nDefault is false.", "type": [ "boolean", "null" ] }, "stages": { "description": "Select which git hook(s) to run for.\nDefault all stages are selected.\nSee .", "type": [ "array", "null" ], "items": { "$ref": "#/definitions/Stage" } }, "verbose": { "description": "Print the output of the hook even if it passes.\nDefault is false.", "type": [ "boolean", "null" ] }, "minimum_prek_version": { "description": "The minimum version of prek required to run this hook.", "type": [ "string", "null" ], "default": null } }, "required": [ "id" ], "additionalProperties": true }, "BuiltinHooks": { "type": "string", "enum": [ "check-added-large-files", "check-case-conflict", "check-executables-have-shebangs", "check-json", "check-json5", "check-merge-conflict", "check-symlinks", "check-toml", "check-xml", "check-yaml", "detect-private-key", "end-of-file-fixer", "fix-byte-order-marker", "mixed-line-ending", "no-commit-to-branch", "trailing-whitespace" ] }, "HookType": { "type": "string", "enum": [ "commit-msg", "post-checkout", "post-commit", "post-merge", "post-rewrite", "pre-commit", "pre-merge-commit", "pre-push", "pre-rebase", "prepare-commit-msg" ] } } }