diff --git a/.github/workflows/daily.yaml b/.github/workflows/cron.yaml similarity index 87% rename from .github/workflows/daily.yaml rename to .github/workflows/cron.yaml index b604e9f8a..995e07c67 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/cron.yaml @@ -1,8 +1,8 @@ name: daily on: - # build every day at 4:00 AM UTC + # build on Sunday at 4:00 AM UTC schedule: - - cron: '0 4 * * *' + - cron: '0 4 * * 0' workflow_dispatch: @@ -26,6 +26,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v6 with: + title: 'Update vendored schemas' commit-message: '[vendor-schemas] automated update' branch: vendor-schemas-auto reviewers: sirosen diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36537bca1..00059c8e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # dogfood - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.0 + rev: 0.28.1 hooks: - id: check-dependabot - id: check-github-workflows diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 87e3d7d14..7bb450616 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -164,6 +164,23 @@ \.renovaterc(\.json)? )$ +# this hook is autogenerated from a script +# to modify this hook, update `src/check_jsonschema/catalog.py` +# and run `make generate-hooks` or `tox run -e generate-hooks-config` +- id: check-taskfile + name: Validate Taskfile Config + description: 'Validate Taskfile config against the schema provided by Task' + entry: check-jsonschema --builtin-schema vendor.taskfile + language: python + files: > + (?x)^( + Taskfile\.(yml|yaml)| + taskfile\.(yml|yaml)| + Taskfile\.dist\.(yml|yaml)| + taskfile\.dist\.(yml|yaml) + )$ + types: [yaml] + # this hook is autogenerated from a script # to modify this hook, update `src/check_jsonschema/catalog.py` # and run `make generate-hooks` or `tox run -e generate-hooks-config` diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d05d19612..2834aae60 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,12 @@ Unreleased .. vendor-insert-here +0.28.2 +------ + +- Update vendored schemas: cloudbuild, gitlab-ci, renovate (2024-04-10) +- Add Taskfile schema and pre-commit hook. Thanks :user:`jrdnbradford`! (:pr:`417`) + 0.28.1 ------ diff --git a/README.md b/README.md index a3ceb3f5f..31428b912 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ files. ```yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-github-workflows args: ["--verbose"] diff --git a/docs/optional_parsers.rst b/docs/optional_parsers.rst index ba3a20fcc..87d6fe2eb 100644 --- a/docs/optional_parsers.rst +++ b/docs/optional_parsers.rst @@ -20,7 +20,7 @@ For example, .. code-block:: yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-renovate additional_dependencies: ['pyjson5'] @@ -45,7 +45,7 @@ For example, .. code-block:: yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-jsonschema name: 'Check GitHub Workflows' diff --git a/docs/precommit_usage.rst b/docs/precommit_usage.rst index ccddb73f5..f4f5c6154 100644 --- a/docs/precommit_usage.rst +++ b/docs/precommit_usage.rst @@ -17,7 +17,7 @@ You must specify a schema using pre-commit ``args`` configuration. :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-jsonschema files: ^data/.*\.json$ @@ -34,7 +34,7 @@ Validate JSON Schema files against their matching metaschema, as specified in th :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-metaschema files: ^schemas/.*\.json$ @@ -52,7 +52,7 @@ Validate Azure Pipelines config against the schema provided by Microsoft :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-azure-pipelines @@ -66,7 +66,7 @@ Validate Bamboo Specs against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-bamboo-spec @@ -80,7 +80,7 @@ Validate Bitbucket Pipelines against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-bitbucket-pipelines @@ -94,7 +94,7 @@ Validate Buildkite Pipelines against the schema provided by Buildkite :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-buildkite @@ -108,7 +108,7 @@ Validate Google Cloud Build config against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-cloudbuild @@ -122,7 +122,7 @@ Validate Dependabot Config (v2) against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-dependabot @@ -136,7 +136,7 @@ Validate Drone-CI Config against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-drone-ci @@ -150,7 +150,7 @@ Validate GitHub Actions against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-github-actions @@ -164,7 +164,7 @@ Validate GitHub Workflows against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-github-workflows @@ -178,7 +178,7 @@ Validate GitLab CI config against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-gitlab-ci @@ -192,7 +192,7 @@ Validate ReadTheDocs config against the schema provided by ReadTheDocs :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-readthedocs @@ -206,11 +206,25 @@ Validate Renovate config against the schema provided by Renovate (does not suppo :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-renovate +``check-taskfile`` +~~~~~~~~~~~~~~~~~~ + +Validate Taskfile config against the schema provided by Task + +.. code-block:: yaml + :caption: example config + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.28.2 + hooks: + - id: check-taskfile + + ``check-travis`` ~~~~~~~~~~~~~~~~ @@ -220,7 +234,7 @@ Validate Travis Config against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-travis @@ -234,7 +248,7 @@ Validate Woodpecker Config against the schema provided by SchemaStore :caption: example config - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-woodpecker-ci @@ -260,7 +274,7 @@ manually, you could do this: .. code-block:: yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-jsonschema name: "Check GitHub Workflows" @@ -279,7 +293,7 @@ To check with the builtin schema that a GitHub workflow sets .. code-block:: yaml - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.1 + rev: 0.28.2 hooks: - id: check-jsonschema name: "Check GitHub Workflows set timeout-minutes" diff --git a/docs/usage.rst b/docs/usage.rst index 831eb13e5..bfe53db6f 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -98,6 +98,7 @@ SchemaStore and other sources: - ``vendor.gitlab-ci`` - ``vendor.readthedocs`` - ``vendor.renovate`` +- ``vendor.taskfile`` - ``vendor.travis`` - ``vendor.woodpecker-ci`` diff --git a/setup.cfg b/setup.cfg index 42c51c85e..8aae927d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = check-jsonschema -version = 0.28.1 +version = 0.28.2 description = A jsonschema CLI and pre-commit hook long_description = file: README.md long_description_content_type = text/markdown diff --git a/src/check_jsonschema/builtin_schemas/vendor/LICENSE.task b/src/check_jsonschema/builtin_schemas/vendor/LICENSE.task new file mode 100644 index 000000000..894ee77ed --- /dev/null +++ b/src/check_jsonschema/builtin_schemas/vendor/LICENSE.task @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Andrey Nering + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.json b/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.json index 4e306a490..0dd1747f6 100644 --- a/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.json +++ b/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.json @@ -141,8 +141,7 @@ "name": { "description": "Required. The full resource name of the private pool of the form 'projects/$PRIVATEPOOL_PROJECT_ID/locations/$REGION/workerPools/$PRIVATEPOOL_ID'.", "markdownDescription": "Required. The full resource name of the private pool of the form `projects/$PRIVATEPOOL_PROJECT_ID/locations/$REGION/workerPools/$PRIVATEPOOL_ID`.", - "type": "string", - "pattern": "^projects/\\w+/locations/\\w+/workerPools/\\w+$" + "type": "string" } }, "additionalProperties": false, @@ -459,8 +458,7 @@ }, "serviceAccount": { "description": "Use this field to specify the IAM service account to use at build time.", - "type": "string", - "pattern": "^projects/[\\w\\-]+/serviceAccounts/[\\w\\-.]+@[\\w\\-.]+$" + "type": "string" }, "queueTtl": { "description": "Specifies the amount of time a build can be queued. If a build is in the queue for longer than the value set in queueTtl, the build expires and the build status is set to EXPIRED.", diff --git a/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.sha256 b/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.sha256 index e688e01ba..52446db12 100644 --- a/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.sha256 +++ b/src/check_jsonschema/builtin_schemas/vendor/cloudbuild.sha256 @@ -1 +1 @@ -474e44b301e178962532c55fec47821df1830766feda209c357c8f8a1ae4e585 \ No newline at end of file +dd8ca403854c351c5c3d7f55518b9cc05029b6df663eab7d872b46063b7842c3 \ No newline at end of file diff --git a/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.json b/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.json index fd3623162..febefd6b3 100644 --- a/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.json +++ b/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.json @@ -1175,11 +1175,60 @@ ] }, "exists": { - "type": "array", "markdownDescription": "Additional attributes will be provided to job if any of the provided paths matches an existing file in the repository. [Learn More](https://docs.gitlab.com/ee/ci/yaml/#rulesexists).", - "items": { - "type": "string" - } + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "paths" + ], + "properties": { + "paths": { + "type": "array", + "description": "List of file paths.", + "items": { + "type": "string" + } + }, + "project": { + "type": "string", + "description": "Path of the project to search in." + } + } + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "paths", + "project" + ], + "properties": { + "paths": { + "type": "array", + "description": "List of file paths.", + "items": { + "type": "string" + } + }, + "project": { + "type": "string", + "description": "Path of the project to search in." + }, + "ref": { + "type": "string", + "description": "Ref of the project to search in." + } + } + } + ] }, "timeout": { "type": "string", diff --git a/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.sha256 b/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.sha256 index 9d83c0c44..af6d5a7ef 100644 --- a/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.sha256 +++ b/src/check_jsonschema/builtin_schemas/vendor/gitlab-ci.sha256 @@ -1 +1 @@ -928f2e3f77ca7ae007f284496a2ad0bbfef12febdee62099f8b1b742ba6c54cd \ No newline at end of file +fd6be5cd001bd79e0a0a0a10111b84d41e854ec18fb285cf2414b4c85bac533c \ No newline at end of file diff --git a/src/check_jsonschema/builtin_schemas/vendor/renovate.json b/src/check_jsonschema/builtin_schemas/vendor/renovate.json index a5cd8185f..9ecdffbaa 100644 --- a/src/check_jsonschema/builtin_schemas/vendor/renovate.json +++ b/src/check_jsonschema/builtin_schemas/vendor/renovate.json @@ -934,7 +934,7 @@ "dockerSidecarImage": { "description": "Change this value to override the default Renovate sidecar image.", "type": "string", - "default": "ghcr.io/containerbase/sidecar:10.3.8" + "default": "ghcr.io/containerbase/sidecar:10.3.13" }, "dockerUser": { "description": "Set the `UID` and `GID` for Docker-based binaries if you use `binarySource=docker`.", @@ -2798,7 +2798,7 @@ "default": 0 }, "prTitle": { - "description": "Pull Request title template (deprecated). Inherits from `commitMessage` if null.", + "description": "Pull Request title template. Inherits from `commitMessage` if null.", "type": "string", "default": null }, @@ -3100,6 +3100,16 @@ }, "$ref": "#" }, + "scalafmt": { + "description": "Configuration object for the scalafmt manager", + "type": "object", + "default": { + "fileMatch": [ + "(^|/)\\.scalafmt.conf$" + ] + }, + "$ref": "#" + }, "schedule": { "description": "Limit branch creation to these times of day or week.", "oneOf": [ diff --git a/src/check_jsonschema/builtin_schemas/vendor/renovate.sha256 b/src/check_jsonschema/builtin_schemas/vendor/renovate.sha256 index cf1bca74d..aca382195 100644 --- a/src/check_jsonschema/builtin_schemas/vendor/renovate.sha256 +++ b/src/check_jsonschema/builtin_schemas/vendor/renovate.sha256 @@ -1 +1 @@ -38121f8e11598b5920e782ac5dc9f1fd01afe4e44d64f9846cec418c7a641a9b \ No newline at end of file +ffad7a78901c229bcd47b8fe862e4d01eea794b2404276eb405f7504372a3839 \ No newline at end of file diff --git a/src/check_jsonschema/builtin_schemas/vendor/taskfile.json b/src/check_jsonschema/builtin_schemas/vendor/taskfile.json new file mode 100644 index 000000000..fb5c3364e --- /dev/null +++ b/src/check_jsonschema/builtin_schemas/vendor/taskfile.json @@ -0,0 +1,700 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "title": "Taskfile YAML Schema", + "description": "Schema for Taskfile files.", + "definitions": { + "env": { + "$ref": "#/definitions/vars" + }, + "tasks": { + "type": "object", + "patternProperties": { + "^.*$": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/task_call" + } + ] + } + }, + { + "$ref": "#/definitions/task" + } + ] + } + } + }, + "task": { + "type": "object", + "additionalProperties": false, + "properties": { + "cmds": { + "description": "A list of commands to be executed.", + "$ref": "#/definitions/cmds" + }, + "cmd": { + "description": "The command to be executed.", + "$ref": "#/definitions/cmd" + }, + "deps": { + "description": "A list of dependencies of this task. Tasks defined here will run in parallel before this task.", + "$ref": "#/definitions/deps" + }, + "label": { + "description": "Overrides the name of the task in the output when a task is run. Supports variables.", + "type": "string" + }, + "desc": { + "description": "A short description of the task. This is displayed when calling `task --list`.", + "type": "string" + }, + "prompt": { + "description": "A prompt that will be presented before a task is run. Declining will cancel running the current and any subsequent tasks.", + "type": "string" + }, + "summary": { + "description": "A longer description of the task. This is displayed when calling `task --summary [task]`.", + "type": "string" + }, + "aliases": { + "description": "A list of alternative names by which the task can be called.", + "type": "array", + "items": { + "type": "string" + } + }, + "sources": { + "description": "A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs.", + "type": "array", + "items": { + "$ref": "#/definitions/glob" + } + }, + "generates": { + "description": "A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs.", + "type": "array", + "items": { + "$ref": "#/definitions/glob" + } + }, + "status": { + "description": "A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`.", + "type": "array", + "items": { + "type": "string" + } + }, + "preconditions": { + "description": "A list of commands to check if this task should run. If a condition is not met, the task will error.", + "type": "array", + "items": { + "$ref": "#/definitions/precondition" + } + }, + "dir": { + "description": "The directory in which this task should run. Defaults to the current working directory.", + "type": "string" + }, + "set": { + "description": "Enables POSIX shell options for all of a task's commands. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html", + "type": "array", + "items": { + "$ref": "#/definitions/set" + } + }, + "shopt": { + "description": "Enables Bash shell options for all of a task's commands. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html", + "type": "array", + "items": { + "$ref": "#/definitions/shopt" + } + }, + "vars": { + "description": "A set of variables that can be used in the task.", + "$ref": "#/definitions/vars" + }, + "env": { + "description": "A set of environment variables that will be made available to shell commands.", + "$ref": "#/definitions/env" + }, + "dotenv": { + "description": "A list of `.env` file paths to be parsed.", + "type": "array", + "items": { + "type": "string" + } + }, + "silent": { + "description": "Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. When combined with the `--list` flag, task descriptions will be hidden.", + "type": "boolean", + "default": false + }, + "interactive": { + "description": "Tells task that the command is interactive.", + "type": "boolean", + "default": false + }, + "internal": { + "description": "Stops a task from being callable on the command line. It will also be omitted from the output when used with `--list`.", + "type": "boolean", + "default": false + }, + "method": { + "description": "Defines which method is used to check the task is up-to-date. `timestamp` will compare the timestamp of the sources and generates files. `checksum` will check the checksum (You probably want to ignore the .task folder in your .gitignore file). `none` skips any validation and always run the task.", + "type": "string", + "enum": ["none", "checksum", "timestamp"], + "default": "none" + }, + "prefix": { + "description": "Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`.", + "type": "string" + }, + "ignore_error": { + "description": "Continue execution if errors happen while executing commands.", + "type": "boolean" + }, + "run": { + "description": "Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`.", + "$ref": "#/definitions/run" + }, + "platforms": { + "description": "Specifies which platforms the task should be run on.", + "type": "array", + "items": { + "type": "string" + } + }, + "requires": { + "description": "A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run", + "$ref": "#/definitions/requires_obj" + }, + "watch": { + "description": "Configures a task to run in watch mode automatically.", + "type": "boolean", + "default": false + } + } + }, + "cmds": { + "type": "array", + "items": { + "$ref": "#/definitions/cmd" + } + }, + "cmd": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/cmd_call" + }, + { + "$ref": "#/definitions/task_call" + }, + { + "$ref": "#/definitions/defer_call" + }, + { + "$ref": "#/definitions/for_cmds_call" + } + ] + }, + "deps": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/task_call" + }, + { + "$ref": "#/definitions/for_deps_call" + } + ] + } + }, + "set": { + "type": "string", + "enum": [ + "allexport", + "a", + "errexit", + "e", + "noexec", + "n", + "noglob", + "f", + "nounset", + "u", + "xtrace", + "x", + "pipefail" + ] + }, + "shopt": { + "type": "string", + "enum": ["expand_aliases", "globstar", "nullglob"] + }, + "vars": { + "type": "object", + "patternProperties": { + "^.*$": { + "anyOf": [ + { + "type": ["boolean", "integer", "null", "number", "string", "object", "array"] + }, + { + "$ref": "#/definitions/var_subkey" + } + ] + } + } + }, + "var_subkey": { + "type": "object", + "properties": { + "sh": { + "type": "string", + "description": "The value will be treated as a command and the output assigned to the variable" + }, + "ref": { + "type": "string", + "description": "The value will be used to lookup the value of another variable which will then be assigned to this variable" + }, + "map": { + "type": "object", + "description": "The value will be treated as a literal map type and stored in the variable" + }, + "json": { + "type": "string", + "description": "The value will parsed as a JSON string and stored in the variable" + }, + "yaml": { + "type": "string", + "description": "The value will parsed as a YAML string and stored in the variable" + }, + "additionalProperties": false + } + }, + "task_call": { + "type": "object", + "properties": { + "task": { + "description": "Name of the task to run", + "type": "string" + }, + "vars": { + "description": "Values passed to the task called", + "$ref": "#/definitions/vars" + }, + "silent": { + "description": "Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`.", + "type": "boolean" + } + }, + "additionalProperties": false, + "required": ["task"] + }, + "cmd_call": { + "type": "object", + "properties": { + "cmd": { + "description": "Command to run", + "type": "string" + }, + "silent": { + "description": "Silent mode disables echoing of command before Task runs it", + "type": "boolean" + }, + "set": { + "description": "Enables POSIX shell options for this command. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html", + "type": "array", + "items": { + "$ref": "#/definitions/set" + } + }, + "shopt": { + "description": "Enables Bash shell options for this command. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html", + "type": "array", + "items": { + "$ref": "#/definitions/shopt" + } + }, + "ignore_error": { + "description": "Prevent command from aborting the execution of task even after receiving a status code of 1", + "type": "boolean" + }, + "platforms": { + "description": "Specifies which platforms the command should be run on.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": ["cmd"] + }, + "defer_call": { + "type": "object", + "properties": { + "defer": { + "description": "Run a command when the task completes. This command will run even when the task fails", + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "task": { + "description": "Name of the task to defer", + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + }, + "additionalProperties": false, + "required": ["defer"] + }, + "for_cmds_call": { + "type": "object", + "properties": { + "for": { + "$ref": "#/definitions/for" + }, + "cmd": { + "description": "Command to run", + "type": "string" + }, + "silent": { + "description": "Silent mode disables echoing of command before Task runs it", + "type": "boolean" + }, + "task": { + "description": "Task to run", + "type": "string" + }, + "vars": { + "description": "Values passed to the task called", + "$ref": "#/definitions/vars" + } + }, + "oneOf": [ + {"required": ["cmd"]}, + {"required": ["task"]} + ], + "additionalProperties": false, + "required": ["for"] + }, + "for_deps_call": { + "type": "object", + "properties": { + "for": { + "$ref": "#/definitions/for" + }, + "silent": { + "description": "Silent mode disables echoing of command before Task runs it", + "type": "boolean" + }, + "task": { + "description": "Task to run", + "type": "string" + }, + "vars": { + "description": "Values passed to the task called", + "$ref": "#/definitions/vars" + } + }, + "oneOf": [ + {"required": ["cmd"]}, + {"required": ["task"]} + ], + "additionalProperties": false, + "required": ["for"] + }, + "for": { + "anyOf": [ + { + "$ref": "#/definitions/for_list" + }, + { + "$ref": "#/definitions/for_attribute" + }, + { + "$ref": "#/definitions/for_var" + } + ] + }, + "for_list": { + "description": "A list of values to iterate over", + "type": "array", + "items": { + "type": "string" + } + }, + "for_attribute": { + "description": "The task attribute to iterate over", + "type": "string", + "enum": ["sources"] + }, + "for_var": { + "description": "Which variables to iterate over. The variable will be split using any whitespace character by default. This can be changed by using the `split` attribute.", + "type": "object", + "properties": { + "var": { + "description": "Name of the variable to iterate over", + "type": "string" + }, + "split": { + "description": "String to split the variable on", + "type": "string" + }, + "as": { + "description": "What the loop variable should be named", + "default": "ITEM", + "type": "string" + } + }, + "additionalProperties": false, + "required": ["var"] + }, + "precondition": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/precondition_obj" + } + ] + }, + "precondition_obj": { + "type": "object", + "properties": { + "sh": { + "description": "Command to run. If that command returns 1, the condition will fail", + "type": "string" + }, + "msg": { + "description": "Failure message to display when the condition fails", + "type": "string" + } + } + }, + "glob": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/glob_obj" + } + ] + }, + "glob_obj": { + "type": "object", + "properties": { + "exclude": { + "description": "File or glob patter to exclude from the list", + "type": "string" + } + } + }, + "run": { + "type": "string", + "enum": ["always", "once", "when_changed"] + }, + "outputString": { + "type": "string", + "enum": ["interleaved", "prefixed", "group"], + "default": "interleaved" + }, + "outputObject": { + "type": "object", + "properties": { + "group": { + "type": "object", + "properties": { + "begin": { + "type": "string" + }, + "end": { + "type": "string" + }, + "error_only": { + "description": "Swallows command output on zero exit code", + "type": "boolean", + "default": false + } + } + } + } + }, + "requires_obj": { + "type": "object", + "properties": { + "vars": { + "description": "List of variables that must be defined for the task to run", + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "allOf": [ + { + "type": "object", + "properties": { + "version": { + "description": "Specify the Taskfile format that this file conforms to.", + "oneOf": [ + { + "type": "string", + "pattern": "^(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:\\.(0|[1-9]\\d*))?(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$" + }, + { + "type": "number", + "enum": [3] + } + ] + }, + "output": { + "description": "Defines how the STDOUT and STDERR are printed when running tasks in parallel. The interleaved output prints lines in real time (default). The group output will print the entire output of a command once, after it finishes, so you won't have live feedback for commands that take a long time to run. The prefix output will prefix every line printed by a command with [task-name] as the prefix, but you can customize the prefix for a command with the prefix: attribute.", + "anyOf": [ + { "$ref": "#/definitions/outputString" }, + { "$ref": "#/definitions/outputObject" } + ] + }, + "method": { + "description": "Defines which method is used to check the task is up-to-date. (default: checksum)", + "type": "string", + "enum": ["none", "checksum", "timestamp"], + "default": "checksum" + }, + "includes": { + "description": "Imports tasks from the specified taskfiles. The tasks described in the given Taskfiles will be available with the informed namespace.", + "type": "object", + "patternProperties": { + "^.*$": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "taskfile": { + "description": "The path for the Taskfile or directory to be included. If a directory, Task will look for files named `Taskfile.yml` or `Taskfile.yaml` inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile.", + "type": "string" + }, + "dir": { + "description": "The working directory of the included tasks when run.", + "type": "string" + }, + "optional": { + "description": "If `true`, no errors will be thrown if the specified file does not exist.", + "type": "boolean" + }, + "internal": { + "description": "Stops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with `--list`.", + "type": "boolean" + }, + "aliases": { + "description": "Alternative names for the namespace of the included Taskfile.", + "type": "array", + "items": { + "type": "string" + } + }, + "vars": { + "description": "A set of variables to apply to the included Taskfile.", + "$ref": "#/definitions/vars" + } + } + } + ] + } + } + }, + "vars": { + "description": "A set of global variables.", + "$ref": "#/definitions/vars" + }, + "env": { + "description": "A set of global environment variables.", + "$ref": "#/definitions/env" + }, + "tasks": { + "description": "A set of task definitions.", + "$ref": "#/definitions/tasks" + }, + "silent": { + "description": "Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis.", + "type": "boolean" + }, + "set": { + "description": "Enables POSIX shell options for all commands in the Taskfile. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html", + "type": "array", + "items": { + "$ref": "#/definitions/set" + } + }, + "shopt": { + "description": "Enables Bash shell options for all commands in the Taskfile. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html", + "type": "array", + "items": { + "$ref": "#/definitions/shopt" + } + }, + "dotenv": { + "type": "array", + "description": "A list of `.env` file paths to be parsed.", + "items": { + "type": "string" + } + }, + "run": { + "description": "Default 'run' option for this Taskfile. Available options: `always`, `once` and `when_changed`.", + "$ref": "#/definitions/run" + }, + "interval": { + "description": "Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid Go duration: https://pkg.go.dev/time#ParseDuration.", + "type": "string", + "pattern": "^[0-9]+(?:m|s|ms)$" + } + }, + "additionalProperties": false, + "required": ["version"], + "anyOf": [ + { + "required": ["includes"] + }, + { + "required": ["tasks"] + }, + { + "required": ["includes", "tasks"] + } + ] + } + ] +} diff --git a/src/check_jsonschema/builtin_schemas/vendor/taskfile.sha256 b/src/check_jsonschema/builtin_schemas/vendor/taskfile.sha256 new file mode 100644 index 000000000..17df7f0a5 --- /dev/null +++ b/src/check_jsonschema/builtin_schemas/vendor/taskfile.sha256 @@ -0,0 +1 @@ +4f4897c0732ae4b76f2b42c7408ada689a5975088140676e708ff411ce8a2e92 diff --git a/src/check_jsonschema/catalog.py b/src/check_jsonschema/catalog.py index 13736cdac..24d408da4 100644 --- a/src/check_jsonschema/catalog.py +++ b/src/check_jsonschema/catalog.py @@ -157,6 +157,22 @@ def _githubusercontent_url(owner: str, repo: str, ref: str, path: str) -> str: ], }, }, + "taskfile": { + "url": "https://taskfile.dev/schema.json", + "hook_config": { + "name": "Validate Taskfile Config", + "description": ( + "Validate Taskfile config against the schema provided by Task" + ), + "files": [ + r"Taskfile\.(yml|yaml)", + r"taskfile\.(yml|yaml)", + r"Taskfile\.dist\.(yml|yaml)", + r"taskfile\.dist\.(yml|yaml)", + ], + "types": "yaml", + }, + }, "travis": { "url": "https://json.schemastore.org/travis", "hook_config": {