chore: add C code linting & formatting

This commit is contained in:
Jef Roosens 2023-01-15 18:01:26 +01:00
parent 7ec0c96f5f
commit 6d1b4aadb6
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 84 additions and 48 deletions

View file

@ -70,22 +70,42 @@ man: vieter
# =====OTHER=====
# Linting
.PHONY: lint
lint:
lint: lint-v lint-c
.PHONY: lint-v
lint-v:
$(V) fmt -verify $(SRC_DIR)
$(V) vet -W $(SRC_DIR)
$(V_PATH) missdoc -p $(SRC_DIR)
@ [ $$($(V_PATH) missdoc -p $(SRC_DIR) | wc -l) = 0 ]
# Format the V codebase
.PHONY: lint-c
lint-c:
clang-format --Werror -n $(SRCS_C) $(SRCS_H)
# Formatting
.PHONY: fmt
fmt:
fmt: fmt-v fmt-c
.PHONY: fmt-v
fmt-v:
$(V) fmt -w $(SRC_DIR)
.PHONY: fmt-c
fmt-c:
clang-format -i $(SRCS_C) $(SRCS_H)
# Testing
.PHONY: test
test:
$(V) -g test $(SRC_DIR)
# Cleaning
.PHONY: clean
clean:
rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'pkg' 'src/vieter' *.pkg.tar.zst 'suvieter' 'afvieter' '$(SRC_DIR)/_docs' 'docs/public'