chore: add C code linting & formatting
This commit is contained in:
parent
7ec0c96f5f
commit
6d1b4aadb6
6 changed files with 84 additions and 48 deletions
26
Makefile
26
Makefile
|
|
@ -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'
|
||||
|
|
|
|||
Reference in a new issue