diff --git a/.github/workflows/check_indentation.yml b/.github/workflows/check_indentation.yml new file mode 100644 index 0000000..b4f089f --- /dev/null +++ b/.github/workflows/check_indentation.yml @@ -0,0 +1,18 @@ +name: Check indentation + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Check tabs + run: make test_tabs diff --git a/Makefile b/Makefile index 90fd8a5..d3c932d 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ build: \ ARCH := $(shell uname -m) -MAIN_RS_SRCS := $(shell find src -type f -regex '^.*\.rs$$') Cargo.toml \ - client/dst/index.html client/dst/script.js client/dst/style.css \ - config.json +FILES_RS := $(shell find src -type f -regex '^.*\.rs$$') +FILES_CLIENT := client/dst/index.html client/dst/script.js client/dst/style.css +MAIN_RS_SRCS := $(FILES_RS) $(FILES_CLIENT) Cargo.toml config.json SEARCH_REPLACE := lib/search_and_replace/target/release/search_and_replace @@ -27,6 +27,17 @@ test: target/debug/zmp24 BIND_TO="$(DEV_BIND)" \ cargo test +.PHONY: test_tabs +test_tabs: + @for file in $(FILES_RS); do \ + echo -n "$$file ... "; \ + if grep -Eq '^\s* ' "$$file"; then \ + echo "fail"; \ + exit 1; \ + fi; \ + echo "ok"; \ + done + .PHONY: clean clean: client_clean cargo clean