Joey Armstrong | b085c50 | 2023-01-17 13:56:24 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | # ----------------------------------------------------------------------- |
| 5 | |
| 6 | ##-------------------## |
| 7 | ##---] GLOBALS [---## |
| 8 | ##-------------------## |
| 9 | |
| 10 | # Gather sources to check |
| 11 | # TODO: implement deps, only check modified files |
| 12 | shell-check-find := find . |
| 13 | # vendor scripts but they really should be lintable |
| 14 | shell-check-find += -name 'vendor' -prune |
| 15 | shell-check-find += -o \( -name '*.sh' \) |
| 16 | shell-check-find += -type f -print0 |
| 17 | |
| 18 | # shell-check := $(env-clean) pylint |
| 19 | shell-check := shellcheck |
| 20 | |
| 21 | shell-check-args += -a |
| 22 | |
| 23 | ##-------------------## |
| 24 | ##---] TARGETS [---## |
| 25 | ##-------------------## |
| 26 | ifndef NO-LINT-SHELL |
| 27 | lint : lint-shell |
| 28 | endif |
| 29 | |
| 30 | ## ----------------------------------------------------------------------- |
| 31 | ## ----------------------------------------------------------------------- |
| 32 | lint-shell: |
| 33 | $(shell-check) -V |
| 34 | @echo |
| 35 | $(HIDE)$(env-clean) $(shell-check-find) \ |
| 36 | | $(xargs-n1) $(shell-check) $(shell-check-args) |
| 37 | |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | ## ----------------------------------------------------------------------- |
| 40 | help :: |
| 41 | @echo ' lint-shell Syntax check shell sources' |
| 42 | |
| 43 | # [EOF] |