Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9346370
D305.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
728 B
Subscribers
None
D305.diff
View Options
diff --git a/Makefile.python b/Makefile.python
--- a/Makefile.python
+++ b/Makefile.python
@@ -32,6 +32,12 @@
check-codespell:
find . -name '*.py' | xargs $(CODESPELL) $(CODESPELLFLAGS)
+.PHONY: check-staged
+check-staged:
+ git diff -z --staged --name-only -- '*.py' \
+ | xargs -0 -L1 -i'{}' /bin/sh -c \
+ "git show ':{}' | $(FLAKE) $(FLAKEFLAGS) --stdin-display-name '{}' -"
+
.PHONY: lint
lint:
$(LINT) $(LINTFLAGS) $(PYMODULE)
diff --git a/bin/git-add-pre-commit-hook b/bin/git-add-pre-commit-hook
--- a/bin/git-add-pre-commit-hook
+++ b/bin/git-add-pre-commit-hook
@@ -13,7 +13,7 @@
if ! [ -x "$HOOK" ] ; then
cat > "$HOOK" <<EOF
#!/bin/sh
-make check
+make check-staged
EOF
chmod +x "$HOOK"
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 3:57 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217918
Attached To
D305: Makefile.python: add check-staged rule for pre-commit hook
Event Timeline
Log In to Comment