File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,9 @@ Thanks for your interest in contributing! This guide will help you get started.
771 . Fork and clone the repository
882 . Create a new branch: ` git checkout -b my-fix `
993 . Make your changes
10- 4 . Format your code: ` make format `
11- 5 . Test your changes: ` make `
12- 6 . Commit and push
13- 7 . Open a pull request
10+ 4 . Build: ` make ` (this also installs git hooks automatically)
11+ 5 . Commit and push (the git commit hook will check formatting and lint)
12+ 6 . Open a pull request
1413
1514## Requirements
1615
@@ -50,11 +49,14 @@ sudo dnf install clang-tools-extra
5049| ` make format-check ` | Check formatting (used by CI) |
5150| ` make lint ` | Run linter checks |
5251| ` make check ` | Run all checks (format + lint) |
52+ | ` make install-hooks ` | Install git pre-commit hook (runs automatically) |
5353| ` make clean ` | Remove compiled files |
5454
5555## Before Submitting
5656
57- Please run these commands before submitting a pull request:
57+ Git hooks are installed automatically when you run ` make ` , so formatting and linting checks will run before each commit.
58+
59+ You can also run checks manually:
5860
5961``` shell
6062make format # Format your code
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ EXECS = $(SOURCES:%.c=%)
66LDLIBS = -lm
77CFLAGS = -Wall -Wextra -Wpedantic
88
9- all : $(EXECS )
9+ all : install-hooks $(EXECS )
1010
1111lint :
1212 @echo " Linting with compiler warnings..."
@@ -23,11 +23,18 @@ format-check:
2323
2424check : format-check lint
2525
26+ install-hooks :
27+ @if [ -d .git ] && [ ! -f .git/hooks/pre-commit ]; then \
28+ cp scripts/pre-commit .git/hooks/pre-commit; \
29+ chmod +x .git/hooks/pre-commit; \
30+ echo " Pre-commit hook installed." ; \
31+ fi
32+
2633clean :
2734 @for f in $(EXECS ) $(DEBUG_FILES ) ; do \
2835 if [ -e " $$ f" ] || [ -d " $$ f" ]; then \
2936 rm -rf " $$ f" && echo " Removed: $$ f" ; \
3037 fi ; \
3138 done
3239
33- .PHONY : all lint format format-check check clean
40+ .PHONY : all lint format format-check check install-hooks clean
You can’t perform that action at this time.
0 commit comments