Gathering detailed insights and metrics for lefthook
Gathering detailed insights and metrics for lefthook
Gathering detailed insights and metrics for lefthook
Gathering detailed insights and metrics for lefthook
lefthook-linux-x64
The Linux 64-bit binary for lefthook, git hooks manager.
lefthook-freebsd-x64
The FreeBSD 64-bit binary for lefthook, git hooks manager.
lefthook-freebsd-arm64
The FreeBSD ARM 64-bit binary for lefthook, git hooks manager.
lefthook-openbsd-x64
The OpenBSD 64-bit binary for lefthook, git hooks manager.
npm install lefthook
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
5,038 Stars
840 Commits
218 Forks
26 Watching
4 Branches
135 Contributors
Updated on 28 Nov 2024
Go (91.37%)
Ruby (3.98%)
JavaScript (2.06%)
Shell (1.25%)
Python (0.85%)
Makefile (0.49%)
Cumulative downloads
Total Downloads
Last day
-10.7%
36,480
Compared to previous day
Last week
3.9%
208,755
Compared to previous week
Last month
11.8%
857,805
Compared to previous month
Last year
272.5%
6,549,041
Compared to previous year
The fastest polyglot Git hooks manager out there
A Git hooks manager for Node.js, Ruby, Python and many other types of projects.
📖 Read the introduction post
With Go (>= 1.23):
1go install github.com/evilmartians/lefthook@latest
With NPM:
1npm install lefthook --save-dev
For Ruby:
1gem install lefthook
For Python:
1pip install lefthook
Installation guide with more ways to install lefthook: apt, brew, winget, and others.
Configure your hooks, install them once and forget about it: rely on the magic underneath.
1# Configure your hooks 2vim lefthook.yml 3 4# Install them to the git project 5lefthook install 6 7# Enjoy your work with git 8git add -A && git commit -m '...'
lefthook.yml
config options.Gives you more speed. Example
1pre-push: 2 parallel: true
If you want your own list. Custom and prebuilt examples.
1pre-commit: 2 commands: 3 frontend-linter: 4 run: yarn eslint {staged_files} 5 backend-linter: 6 run: bundle exec rubocop --force-exclusion {all_files} 7 frontend-style: 8 files: git diff --name-only HEAD @{push} 9 run: yarn stylelint {files}
If you want to filter list of files. You could find more glob pattern examples here.
1pre-commit: 2 commands: 3 backend-linter: 4 glob: "*.rb" # glob filter 5 exclude: '(^|/)(application|routes)\.rb$' # regexp filter 6 run: bundle exec rubocop --force-exclusion {all_files}
If you want to execute the commands in a relative path
1pre-commit: 2 commands: 3 backend-linter: 4 root: "api/" # Careful to have only trailing slash 5 glob: "*.rb" # glob filter 6 run: bundle exec rubocop {all_files}
If oneline commands are not enough, you can execute files. Example.
1commit-msg: 2 scripts: 3 "template_checker": 4 runner: bash
If you want to control a group of commands. Example.
1pre-push: 2 commands: 3 packages-audit: 4 tags: frontend security 5 run: yarn audit 6 gems-audit: 7 tags: backend security 8 run: bundle audit
If you are in the Docker environment. Example.
1pre-commit: 2 scripts: 3 "good_job.js": 4 runner: docker run -it --rm <container_id_or_name> {cmd}
If you a frontend/backend developer and want to skip unnecessary commands or override something into Docker. Description.
1# lefthook-local.yml 2pre-push: 3 exclude_tags: 4 - frontend 5 commands: 6 packages-audit: 7 skip: true
If you want to run hooks group directly.
1$ lefthook run pre-commit
If you want to run specific group of commands directly.
1fixer: 2 commands: 3 ruby-fixer: 4 run: bundle exec rubocop --force-exclusion --safe-auto-correct {staged_files} 5 js-fixer: 6 run: yarn eslint --fix {staged_files}
1$ lefthook run fixer
If you don't want to see supporting information:
1skip_output: 2 - meta #(version and which hook running) 3 - success #(output from runners with exit code 0)
No vulnerabilities found.
Reason
30 commit(s) and 22 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
packaging workflow detected
Details
Reason
SAST tool is run on all commits
Details
Reason
Found 5/30 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
Project has not signed or included provenance with any releases.
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More