Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 3 | # Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 4 | # ----------------------------------------------------------------------- |
| 5 | |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 6 | ##-------------------## |
| 7 | ##---] GLOBALS [---## |
| 8 | ##-------------------## |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 9 | |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 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 |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 17 | |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 18 | # shell-check := $(env-clean) pylint |
| 19 | shell-check := shellcheck |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 20 | |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 21 | shell-check-args += -a |
| 22 | |
| 23 | ##-------------------## |
| 24 | ##---] TARGETS [---## |
| 25 | ##-------------------## |
| 26 | ifndef NO-LINT-SHELL |
| 27 | lint : lint-shell |
| 28 | endif |
| 29 | |
| 30 | ## ----------------------------------------------------------------------- |
| 31 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 32 | lint-shell: |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 33 | $(shell-check) -V |
| 34 | @echo |
| 35 | $(HIDE)$(env-clean) $(shell-check-find) \ |
| 36 | | $(xargs-n1) $(shell-check) $(shell-check-args) |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 37 | |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 38 | ## ----------------------------------------------------------------------- |
| 39 | ## ----------------------------------------------------------------------- |
| 40 | help :: |
| 41 | @echo ' lint-shell Syntax check shell sources' |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 42 | |
| 43 | # [EOF] |