mirror of
https://github.com/j178/prek.git
synced 2026-04-03 17:34:03 +02:00
* feat(bun): add Bun language support * test(bun): add integration tests for Bun language support Add three integration tests covering the key functionality: - basic_bun: simple hook execution using bun -e - additional_dependencies: verify deps installed via bunx cowsay - language_version: test version specification with language_version: "1" The additional_dependencies test runs twice to verify health_check and cache reuse works correctly. * docs: add Bun to supported languages documentation - Add Bun to toolchain list in README features section - Add Bun to managed toolchain downloads list in languages.md - Add full Bun language section with version format documentation * ci: add Bun setup to test jobs * feat(bun): use GITHUB_TOKEN to avoid API rate limits When listing Bun versions from GitHub releases, use the GITHUB_TOKEN environment variable if available to authenticate requests. This increases the rate limit from 60 to 5,000 requests/hour. GITHUB_TOKEN is automatically set in GitHub Actions workflows. * fix(bun): use consistent bin_dir path on all platforms Bun installs global packages to $BUN_INSTALL/bin/ on all platforms, so bin_dir should always return prefix/bin. The Windows special case was incorrectly copied from Node (which uses npm's different install structure). * Add toolchain download test * Add tests --------- Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
1245 lines
32 KiB
JSON
Generated
1245 lines
32 KiB
JSON
Generated
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "prek configuration file format",
|
|
"type": "object",
|
|
"properties": {
|
|
"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"
|
|
},
|
|
"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"
|
|
}
|
|
},
|
|
"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"
|
|
]
|
|
},
|
|
"files": {
|
|
"description": "Global file include pattern.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "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"
|
|
]
|
|
},
|
|
"repos": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Repo"
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"repos"
|
|
],
|
|
"definitions": {
|
|
"BuiltinHook": {
|
|
"description": "A builtin hook predefined in prek.",
|
|
"type": "object",
|
|
"properties": {
|
|
"additional_dependencies": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"alias": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"always_run": {
|
|
"description": "This hook will run even if there are no matching files.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"args": {
|
|
"description": "Additional arguments to pass to the hook.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"description": {
|
|
"description": "A description of the hook. For metadata only.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"entry": {
|
|
"description": "Entry is not allowed for predefined hooks.",
|
|
"const": false
|
|
},
|
|
"env": {
|
|
"description": "Environment variables to set for the hook.",
|
|
"type": [
|
|
"object",
|
|
"null"
|
|
],
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"exclude": {
|
|
"description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"exclude_types": {
|
|
"description": "List of file types to exclude.\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"fail_fast": {
|
|
"description": "If this hook fails, don't run any more hooks.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"files": {
|
|
"description": "The pattern of files to run on.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"id": {
|
|
"$ref": "#/definitions/BuiltinHooks"
|
|
},
|
|
"language": {
|
|
"anyOf": [
|
|
{
|
|
"description": "Language must be `system` for predefined hooks (or omitted).",
|
|
"type": "string",
|
|
"enum": [
|
|
"system"
|
|
]
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"language_version": {
|
|
"description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee <https://pre-commit.com/#overriding-language-version>.",
|
|
"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"
|
|
]
|
|
},
|
|
"minimum_prek_version": {
|
|
"description": "The minimum version of prek required to run this hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"default": null
|
|
},
|
|
"name": {
|
|
"description": "Override the name of the hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"pass_filenames": {
|
|
"description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.",
|
|
"type": [
|
|
"boolean",
|
|
"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
|
|
},
|
|
"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 <https://pre-commit.com/#confining-hooks-to-run-at-certain-stages>.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Stage"
|
|
}
|
|
},
|
|
"types": {
|
|
"description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"types_or": {
|
|
"description": "List of file types to run on (OR).\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"verbose": {
|
|
"description": "Print the output of the hook even if it passes.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"id"
|
|
]
|
|
},
|
|
"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"
|
|
]
|
|
},
|
|
"BuiltinRepo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"hooks": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/BuiltinHook"
|
|
}
|
|
},
|
|
"repo": {
|
|
"description": "Must be `builtin`.",
|
|
"type": "string",
|
|
"const": "builtin"
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"repo",
|
|
"hooks"
|
|
]
|
|
},
|
|
"FilePattern": {
|
|
"description": "A file pattern, either a regex or glob pattern(s).",
|
|
"type": "object",
|
|
"oneOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"regex": {
|
|
"description": "A regular expression pattern.",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"regex"
|
|
]
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"glob": {
|
|
"oneOf": [
|
|
{
|
|
"description": "A glob pattern.",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"description": "A list of glob patterns.",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"glob"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"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"
|
|
]
|
|
},
|
|
"Language": {
|
|
"type": "string",
|
|
"enum": [
|
|
"bun",
|
|
"conda",
|
|
"coursier",
|
|
"dart",
|
|
"docker",
|
|
"docker_image",
|
|
"dotnet",
|
|
"fail",
|
|
"golang",
|
|
"haskell",
|
|
"lua",
|
|
"node",
|
|
"perl",
|
|
"python",
|
|
"r",
|
|
"ruby",
|
|
"rust",
|
|
"swift",
|
|
"pygrep",
|
|
"script",
|
|
"system"
|
|
]
|
|
},
|
|
"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": {
|
|
"additional_dependencies": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"alias": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"always_run": {
|
|
"description": "This hook will run even if there are no matching files.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"args": {
|
|
"description": "Additional arguments to pass to the hook.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"description": {
|
|
"description": "A description of the hook. For metadata only.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"entry": {
|
|
"description": "The command to run. It can contain arguments that will not be overridden.",
|
|
"type": "string"
|
|
},
|
|
"env": {
|
|
"description": "Environment variables to set for the hook.",
|
|
"type": [
|
|
"object",
|
|
"null"
|
|
],
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"exclude": {
|
|
"description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"exclude_types": {
|
|
"description": "List of file types to exclude.\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"fail_fast": {
|
|
"description": "If this hook fails, don't run any more hooks.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"files": {
|
|
"description": "The pattern of files to run on.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"id": {
|
|
"description": "The id of the hook.",
|
|
"type": "string"
|
|
},
|
|
"language": {
|
|
"description": "The language of the hook. Tells prek how to install and run the hook.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Language"
|
|
}
|
|
]
|
|
},
|
|
"language_version": {
|
|
"description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee <https://pre-commit.com/#overriding-language-version>.",
|
|
"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"
|
|
]
|
|
},
|
|
"minimum_prek_version": {
|
|
"description": "The minimum version of prek required to run this hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"default": null
|
|
},
|
|
"name": {
|
|
"description": "The name of the hook.",
|
|
"type": "string"
|
|
},
|
|
"pass_filenames": {
|
|
"description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"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
|
|
},
|
|
"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 <https://pre-commit.com/#confining-hooks-to-run-at-certain-stages>.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Stage"
|
|
}
|
|
},
|
|
"types": {
|
|
"description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"types_or": {
|
|
"description": "List of file types to run on (OR).\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"verbose": {
|
|
"description": "Print the output of the hook even if it passes.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"id",
|
|
"name",
|
|
"entry",
|
|
"language"
|
|
]
|
|
},
|
|
"LocalRepo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"hooks": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/LocalHook"
|
|
}
|
|
},
|
|
"repo": {
|
|
"description": "Must be `local`.",
|
|
"type": "string",
|
|
"const": "local"
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"repo",
|
|
"hooks"
|
|
]
|
|
},
|
|
"MetaHook": {
|
|
"description": "A meta hook predefined in prek.",
|
|
"type": "object",
|
|
"properties": {
|
|
"additional_dependencies": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"alias": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"always_run": {
|
|
"description": "This hook will run even if there are no matching files.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"args": {
|
|
"description": "Additional arguments to pass to the hook.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"description": {
|
|
"description": "A description of the hook. For metadata only.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"entry": {
|
|
"description": "Entry is not allowed for predefined hooks.",
|
|
"const": false
|
|
},
|
|
"env": {
|
|
"description": "Environment variables to set for the hook.",
|
|
"type": [
|
|
"object",
|
|
"null"
|
|
],
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"exclude": {
|
|
"description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"exclude_types": {
|
|
"description": "List of file types to exclude.\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"fail_fast": {
|
|
"description": "If this hook fails, don't run any more hooks.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"files": {
|
|
"description": "The pattern of files to run on.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"id": {
|
|
"$ref": "#/definitions/MetaHooks"
|
|
},
|
|
"language": {
|
|
"anyOf": [
|
|
{
|
|
"description": "Language must be `system` for predefined hooks (or omitted).",
|
|
"type": "string",
|
|
"enum": [
|
|
"system"
|
|
]
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"language_version": {
|
|
"description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee <https://pre-commit.com/#overriding-language-version>.",
|
|
"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"
|
|
]
|
|
},
|
|
"minimum_prek_version": {
|
|
"description": "The minimum version of prek required to run this hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"default": null
|
|
},
|
|
"name": {
|
|
"description": "Override the name of the hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"pass_filenames": {
|
|
"description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.",
|
|
"type": [
|
|
"boolean",
|
|
"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
|
|
},
|
|
"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 <https://pre-commit.com/#confining-hooks-to-run-at-certain-stages>.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Stage"
|
|
}
|
|
},
|
|
"types": {
|
|
"description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"types_or": {
|
|
"description": "List of file types to run on (OR).\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"verbose": {
|
|
"description": "Print the output of the hook even if it passes.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"id"
|
|
]
|
|
},
|
|
"MetaHooks": {
|
|
"type": "string",
|
|
"enum": [
|
|
"check-hooks-apply",
|
|
"check-useless-excludes",
|
|
"identity"
|
|
]
|
|
},
|
|
"MetaRepo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"hooks": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/MetaHook"
|
|
}
|
|
},
|
|
"repo": {
|
|
"description": "Must be `meta`.",
|
|
"type": "string",
|
|
"const": "meta"
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"repo",
|
|
"hooks"
|
|
]
|
|
},
|
|
"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": {
|
|
"additional_dependencies": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"alias": {
|
|
"description": "Not documented in the official docs.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"always_run": {
|
|
"description": "This hook will run even if there are no matching files.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"args": {
|
|
"description": "Additional arguments to pass to the hook.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"description": {
|
|
"description": "A description of the hook. For metadata only.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"entry": {
|
|
"description": "Override the entrypoint. Not documented in the official docs but works.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"env": {
|
|
"description": "Environment variables to set for the hook.",
|
|
"type": [
|
|
"object",
|
|
"null"
|
|
],
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"exclude": {
|
|
"description": "Exclude files that were matched by `files`.\nDefault is `$^`, which matches nothing.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"exclude_types": {
|
|
"description": "List of file types to exclude.\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"fail_fast": {
|
|
"description": "If this hook fails, don't run any more hooks.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"files": {
|
|
"description": "The pattern of files to run on.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/FilePattern"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"id": {
|
|
"description": "The id of the hook.",
|
|
"type": "string"
|
|
},
|
|
"language": {
|
|
"description": "Override the language. Not documented in the official docs but works.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/Language"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"language_version": {
|
|
"description": "Run the hook on a specific version of the language.\nDefault is `default`.\nSee <https://pre-commit.com/#overriding-language-version>.",
|
|
"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"
|
|
]
|
|
},
|
|
"minimum_prek_version": {
|
|
"description": "The minimum version of prek required to run this hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
],
|
|
"default": null
|
|
},
|
|
"name": {
|
|
"description": "Override the name of the hook.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"pass_filenames": {
|
|
"description": "Append filenames that would be checked to the hook entry as arguments.\nDefault is true.",
|
|
"type": [
|
|
"boolean",
|
|
"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
|
|
},
|
|
"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 <https://pre-commit.com/#confining-hooks-to-run-at-certain-stages>.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Stage"
|
|
}
|
|
},
|
|
"types": {
|
|
"description": "List of file types to run on (AND).\nDefault is `[file]`, which matches all files.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"types_or": {
|
|
"description": "List of file types to run on (OR).\nDefault is `[]`.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"default": null,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"verbose": {
|
|
"description": "Print the output of the hook even if it passes.\nDefault is false.",
|
|
"type": [
|
|
"boolean",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"id"
|
|
]
|
|
},
|
|
"RemoteRepo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"hooks": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/RemoteHook"
|
|
},
|
|
"writeOnly": true
|
|
},
|
|
"repo": {
|
|
"description": "Remote repository location. Must not be `local`, `meta`, or `builtin`.",
|
|
"type": "string",
|
|
"not": {
|
|
"enum": [
|
|
"local",
|
|
"meta",
|
|
"builtin"
|
|
]
|
|
}
|
|
},
|
|
"rev": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": true,
|
|
"required": [
|
|
"repo",
|
|
"rev",
|
|
"hooks"
|
|
]
|
|
},
|
|
"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"
|
|
}
|
|
]
|
|
},
|
|
"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"
|
|
]
|
|
}
|
|
}
|
|
}
|