blob: 5d76f127c5e72af2079570502e703d20101f8728 [file] [log] [blame]
Joey Armstronga5278142023-06-28 16:56:54 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong098eedd2024-02-11 10:00:59 -05003# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstronga5278142023-06-28 16:56:54 -04004#
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## -----------------------------------------------------------------------
26ifndef 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)
32endif# NO-LINT-HADOLINT
33
34# Consistent targets across lint makefiles
35lint-hadolint-all : lint-hadolint
36lint-hadolint-modified : lint-hadolint
37
38## -----------------------------------------------------------------------
39## -----------------------------------------------------------------------
40include $(MAKEDIR)/lint/hadolint/excl.mk
41
42ifdef lint-hadolint-excl
43 lint-hadolint-excl-args += $(addprefix --ignore-path$(space),$(lint-hadolint-excl))
44endif
45lint-hadolint-excl-args += $(addprefix --ignore-path$(space),$(lint-hadolint-excl-raw))
46
47lint-hadolint-args += --max-line-length 120
48
49lint-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## -----------------------------------------------------------------------
61help::
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]