diff --git a/Makefile b/Makefile index df31980e4fc6..75553806ab79 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ BUILDTYPE ?= Release PYTHON ?= python3 RUFF ?= tools/pip/site-packages/bin/ruff +YAMLLINT ?= tools/pip/site-packages/bin/yamllint DESTDIR ?= SIGN ?= PREFIX ?= /usr/local @@ -1719,14 +1720,15 @@ lint-yaml-build: ## Build resources needed to lint YAML files. $(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages yamllint .PHONY: lint-yaml +ifneq ("","$(wildcard $(YAMLLINT))") lint-yaml: ## Lint the YAML files with yamllint. - @if [ -d "tools/pip/site-packages/yamllint" ]; then \ - $(info Running YAML linter...) \ - PYTHONPATH=tools/pip $(PYTHON) -m yamllint .; \ - else \ - echo 'YAML linting with yamllint is not available'; \ - echo "Run 'make lint-yaml-build'"; \ - fi + $(info Running YAML linter...) + PYTHONPATH=tools/pip $(YAMLLINT) . +else +lint-yaml: + $(warning YAML linting with yamllint is not available) + $(warning Run 'make lint-yaml-build') +endif .PHONY: lint .PHONY: lint-ci diff --git a/shell.nix b/shell.nix index 9b4d9da55855..d146361b5c09 100644 --- a/shell.nix +++ b/shell.nix @@ -149,6 +149,14 @@ pkgs.mkShell { RUFF = pkgs.lib.getExe ruff; } ) + // ( + let + yamllint = pkgs.lib.lists.findFirst (p: p.meta.mainProgram == "yamllint") null devTools; + in + pkgs.lib.optionalAttrs (yamllint != null) { + YAMLLINT = pkgs.lib.getExe yamllint; + } + ) // pkgs.lib.optionalAttrs (!withSQLite) { NOSQLITE = "1"; } diff --git a/tools/nix/devTools.nix b/tools/nix/devTools.nix index 0ead37da9108..e33ae720785c 100644 --- a/tools/nix/devTools.nix +++ b/tools/nix/devTools.nix @@ -9,6 +9,7 @@ pkgs.jq pkgs.ruff pkgs.shellcheck + pkgs.yamllint ] ++ ( if (ncu-path == null) then