Skip to content

Commit fd0a393

Browse files
makefile: add a rule to validate shell scripts with shellcheck
This adds a `make check` for top level static checks. Add `make check-shell-scripts` to invoke the shellcheck command. Signed-off-by: John Mulligan <[email protected]>
1 parent bcd585b commit fd0a393

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ endif
1818

1919
BUILD_CMD:=$(CONTAINER_CMD) build $(BUILD_OPTS)
2020
PUSH_CMD:=$(CONTAINER_CMD) push $(PUSH_OPTS)
21+
SHELLCHECK:=shellcheck
2122

2223
SERVER_DIR:=images/server
2324
AD_SERVER_DIR:=images/ad-server
@@ -106,3 +107,12 @@ test-server: build-server
106107
test-nightly-server: build-nightly-server
107108
CONTAINER_CMD=$(CONTAINER_CMD) LOCAL_TAG=$(NIGHTLY_SERVER_NAME) tests/test-samba-container.sh
108109
.PHONY: test-nightly-server
110+
111+
112+
check: check-shell-scripts
113+
.PHONY: check
114+
115+
# rule requires shellcheck and find to run
116+
check-shell-scripts:
117+
$(SHELLCHECK) -P tests/ -eSC2181 -fgcc $$(find -name '*.sh')
118+
.PHONY: check-shell-scripts

0 commit comments

Comments
 (0)