-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New helper script to run fast lints and pre-push hook that runs it #3949
Merged
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ff658b4
Initial scaffolding for a fast linter
jleibs 785e5e4
Run a bunch more lints
jleibs ebc8fcf
Cleanup
jleibs 2edc548
Add to justfile
jleibs c7d4431
Fix print on SKIP
jleibs 012549d
Assorted improvements
jleibs 218a3e4
Cleanup and support --no-file-filter
jleibs 19b07e5
Renames
jleibs 5669a09
Improve skip messages
jleibs 8230e9d
Add a bit to contributing
jleibs a7bb52c
Add a managed hooks folder and installation instructions
jleibs 3652137
Check for pixi
jleibs 664702b
Pixi target for fast-lint
jleibs 7681b79
Pass through git hook arguments in case we want to use them in the fu…
jleibs 3a23cf9
Use exec so we have access to stdin
jleibs e1b2bd7
Only run fast-lint if the pushed branch is active
jleibs eb8fee5
Don't fail if the hook is missing -- such as installing via copy and …
jleibs 20f52fd
Convert indentation to spaces
jleibs 76f39da
Rename the root logger
jleibs 7fbed6f
Re-format log output
jleibs 52fd652
Check that the commands in `--skip` are real commands
emilk 6a955f8
Add environment variable for skipping lints
jleibs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Hooks | ||
This folder contains the official rerun githooks. | ||
|
||
Each hook is designed to call through to a corresponding hook in the scripts directory. | ||
- `pre-push` -> `scripts/pre-push.sh` | ||
|
||
### Installation | ||
To install the hooks, simply copy them into the `.git/hooks` directory of your local checkout. | ||
``` | ||
cp hooks/pre-push .git/hooks/pre-push | ||
chmod +x .git/hooks/pre-push | ||
``` | ||
or if you prefer you can configure git to use this directory as the hooks directory: | ||
``` | ||
git config core.hooksPath hooks | ||
``` | ||
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. TIL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# This is a shim to call through to the managed pre-push hook. | ||
# See: hooks/README.md for more details. | ||
repo_root=$(git rev-parse --show-toplevel) | ||
pre_push_hook=$repo_root/scripts/pre-push.sh | ||
if [ -f "$pre_push_hook" ]; then | ||
exec $pre_push_hook "$@" | ||
else | ||
echo "The pre-push hook appears to be missing from: $pre_push_hook -- Skipping." | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not
chmod +x hooks/pre-push
already?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It generally should be, though I've definitely seen edge-cases across OS's and git configurations where that isn't guaranteed.