Joey Armstrong | a527814 | 2023-06-28 16:56:54 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 098eedd | 2024-02-11 10:00:59 -0500 | [diff] [blame] | 3 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | a527814 | 2023-06-28 16:56:54 -0400 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # ----------------------------------------------------------------------- |
| 17 | |
| 18 | |
| 19 | ##-------------------## |
| 20 | ##---] GLOBALS [---## |
| 21 | ##-------------------## |
| 22 | .PHONY: lint-hadolint lint-hadolint-all lint-hadolint-modified |
| 23 | |
| 24 | ## ----------------------------------------------------------------------- |
| 25 | ## ----------------------------------------------------------------------- |
| 26 | ifndef NO-LINT-HADOLINT |
| 27 | have-rst-files := $(if $(strip $(RST_SOURCE)),true) |
| 28 | RST_SOURCE ?= $(error RST_SOURCE= is required) |
| 29 | |
| 30 | lint-hadolint-mode := $(if $(have-hadolint-files),modified,all) |
| 31 | lint : lint-hadolint-$(lint-hadolint-mode) |
| 32 | endif# NO-LINT-HADOLINT |
| 33 | |
| 34 | # Consistent targets across lint makefiles |
| 35 | lint-hadolint-all : lint-hadolint |
| 36 | lint-hadolint-modified : lint-hadolint |
| 37 | |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | ## ----------------------------------------------------------------------- |
| 40 | include $(MAKEDIR)/lint/hadolint/excl.mk |
| 41 | |
| 42 | ifdef lint-hadolint-excl |
| 43 | lint-hadolint-excl-args += $(addprefix --ignore-path$(space),$(lint-hadolint-excl)) |
| 44 | endif |
| 45 | lint-hadolint-excl-args += $(addprefix --ignore-path$(space),$(lint-hadolint-excl-raw)) |
| 46 | |
| 47 | lint-hadolint-args += --max-line-length 120 |
| 48 | |
| 49 | lint-hadolint: $(venv-activate-script) |
| 50 | @echo |
| 51 | @echo '** -----------------------------------------------------------------------' |
| 52 | @echo '** hadolint *.rst syntax checking' |
| 53 | @echo '** -----------------------------------------------------------------------' |
| 54 | $(activate) && hadolint --version |
| 55 | @echo |
| 56 | $(activate) && hadolint $(lint-hadolint-excl-args) $(lint-hadolint-args) . |
| 57 | |
| 58 | ## ----------------------------------------------------------------------- |
| 59 | ## Intent: Display command usage |
| 60 | ## ----------------------------------------------------------------------- |
| 61 | help:: |
| 62 | @echo ' lint-hadolint Syntax check python using the hadolint command' |
| 63 | ifdef VERBOSE |
| 64 | @echo ' lint-hadolint-all hadolint checking: exhaustive' |
| 65 | @echo ' lint-hadolint-modified hadolint checking: only modified' |
| 66 | endif |
| 67 | |
| 68 | # include $(MAKEDIR)/lint/docker/hadolint.mk |
| 69 | |
| 70 | # [EOF] |