blob: cadc08412e866d89844f90cb07c6e03135f52a1c [file] [log] [blame]
Joey Armstrong28eddda2023-01-10 03:09:34 -05001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong3f575f72023-01-15 23:49:19 -05003# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong28eddda2023-01-10 03:09:34 -05004# -----------------------------------------------------------------------
5
Joey Armstrong3f575f72023-01-15 23:49:19 -05006##-------------------##
7##---] GLOBALS [---##
8##-------------------##
Joey Armstrong28eddda2023-01-10 03:09:34 -05009
Joey Armstrong3f575f72023-01-15 23:49:19 -050010# Gather sources to check
11# TODO: implement deps, only check modified files
12shell-check-find := find .
13# vendor scripts but they really should be lintable
14shell-check-find += -name 'vendor' -prune
15shell-check-find += -o \( -name '*.sh' \)
16shell-check-find += -type f -print0
Joey Armstrong28eddda2023-01-10 03:09:34 -050017
Joey Armstrong3f575f72023-01-15 23:49:19 -050018# shell-check := $(env-clean) pylint
19shell-check := shellcheck
Joey Armstrong28eddda2023-01-10 03:09:34 -050020
Joey Armstrong3f575f72023-01-15 23:49:19 -050021shell-check-args += -a
22
23##-------------------##
24##---] TARGETS [---##
25##-------------------##
26ifndef NO-LINT-SHELL
27 lint : lint-shell
28endif
29
30## -----------------------------------------------------------------------
31## -----------------------------------------------------------------------
Joey Armstrong28eddda2023-01-10 03:09:34 -050032lint-shell:
Joey Armstrong3f575f72023-01-15 23:49:19 -050033 $(shell-check) -V
34 @echo
35 $(HIDE)$(env-clean) $(shell-check-find) \
36 | $(xargs-n1) $(shell-check) $(shell-check-args)
Joey Armstrong28eddda2023-01-10 03:09:34 -050037
Joey Armstrong3f575f72023-01-15 23:49:19 -050038## -----------------------------------------------------------------------
39## -----------------------------------------------------------------------
40help ::
41 @echo ' lint-shell Syntax check shell sources'
Joey Armstrong28eddda2023-01-10 03:09:34 -050042
43# [EOF]