frostfs-api/Makefile
Aleksey Savchuk 6b0f3b01e0
[#58] pre-commit: Add pre-commit and related Makefile targets
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2024-09-02 15:02:24 +03:00

35 lines
812 B
Makefile
Executable file

#!/usr/bin/make -f
SHELL=bash
include help.mk
.PHONY: doc fmt pre-commit unpre-commit pre-commit-run
# Regenerate documentation for proto files:
doc:
@for f in `find . -type f -name '*.proto' -exec dirname {} \; | sort -u `; do \
echo "⇒ Documentation for $$(basename $$f)"; \
protoc \
--doc_opt=.github/markdown.tmpl,$${f}.md \
--proto_path=.:/usr/local/include \
--doc_out=proto-docs/ $${f}/*.proto; \
done
# Run clang-format
fmt:
@for f in `ls **/*.proto`; do \
echo "⇒ Formatting $$f"; \
clang-format -i $$f; \
done
# Activate pre-commit hooks
pre-commit:
pre-commit install --hook-type pre-commit
# Deactivate pre-commit hooks
unpre-commit:
pre-commit uninstall --hook-type pre-commit
# Run pre-commit hooks
pre-commit-run:
@pre-commit run --all-files --hook-stage manual