Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@arkweid/hookah-js
Advanced tools
Hookah it`s a simple manager of git hooks.
Add Hookah to your system or build it from sources.
go get github.com/Arkweid/hookah
npm i @arkweid/hookah-js --save-dev
# or yarn:
yarn add -D @arkweid/hookah-js
# Now you can call it:
npx hookah -h
NOTE: if you install it this way you should call it with npx
for all listed examples below.
sudo snap install --devmode hookah
brew install Arkweid/hookah/hookah
Or take it from binaries and install manualy
Go to your project directory and run:
hookah install
It add for you configuration file hookah.yml
with default directories for hooks sources.
Now we ready to add hooks! For example we want to add pre commit hooks. Lets do that:
hookah add pre-commit
It will add a hook .git/hooks/pre-commit
. So every time when you run git commit
this file will be executed.
That directories also will be created .hookah
and .hookah-local
.
Use first one for project/team hooks. Second one for you personal hooks. Add it to .gitignore
Next fill the directory .hookah/pre-commit
with executables you like
├───.hookah
│ └───pre-commit
│ ├─── fail_script
│ └─── ok_script
Example:
cat > .hookah/pre-commit/fail_script
#!/bin/sh
exit 1
cat > .hookah/pre-commit/ok_script
#!/bin/sh
exit 0
# Now we can commit:
git commit -am "It fail"
Done! Pretty simple, huh?
hookah.yml
pre-commit:
commands:
eslint:
glob: "*.{js,ts}"
runner: yarn eslint {staged_files} # hookah run it like "yarn eslint App.js Model.js ..."
rubocop:
tags: backend style
glob: "*.{rb}"
exclude: "application.rb|routes.rb" # simple regexp for more flexibility
runner: bundle exec rubocop {all_files}
govet:
tags: backend style
files: git ls-files -m # we can explicity define scope of files
glob: "*.{go}"
runner: go vet {files} # {files} will be replaced by matched files as arguments
# If you have script files, you can specify parameters for them
scripts:
"hello.js":
runner: node # hookah run it like "node hello.js"
"any.go":
runner: go run # hookah run it like "go run any.go"
# Not enough speed? Run all of them in parallel!
# Default: false
parallel: true
If your team have backend and frontend developers, you can skip unnsecesary hooks this way:
hookah-local.yml
pre-commit:
# I am fronted developer. Skip all this backend stuff!
exclude_tags:
- backend
scripts:
"any.go":
runner: docker exec -it --rm <container_id_or_name> {cmd} # Wrap command from hookah.yml in docker
commands:
govet:
skip: true # You can also skip command with this option
No problem, hookah have command for that:
hookah run pre-commit
# You will see the summary:
[ FAIL ] fail_script
[ OK ] ok_script
Ok! For example you have any.go
script. We can run it in this way:
Add hookah-local.yml
Add it to .gitignore
. It your personal settings.
Next customize the any.go
script:
pre-commit:
"any.go":
runner: "go run"
Done! Now our script will be executed like this:
go run any.go
We suppose repo already have the hookah structure. So all of you need it run install:
hookah install
Hookah wiil read existed hook groups and reproduce hooks in .git/hooks
directory.
We have env HOOKAH=0 for that
HOOKAH=0 git commit -am "Hookah skipped"
We have env HOOKAH_EXCLUDE=tag,tag for that
HOOKAH_EXCLUDE=ruby,security git commit -am "Skip some tag checks"
No problem. Lets take rubocop
linter for ruby as example:
#!/bin/sh
git ls-files -m | xargs rubocop
Ok-ok! This is how any.go
may looks like:
package main
import (
"fmt"
"os"
"os/exec"
"strings"
"github.com/Arkweid/hookah/context"
)
func main() {
files, _ := context.StagedFiles()
files = context.FilterByExt(files, ".rb")
cmd := exec.Command("rubocop", strings.Join(files, " "))
outputBytes, err := cmd.CombinedOutput()
fmt.Println(string(outputBytes))
if err != nil {
os.Exit(1)
}
}
We include context package only for convenience. It`s just few useful functions.
For pure script you can do it like that:
Example for prepare-commit-msg
hook:
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
# ...
Yes. You can do this through this config keys:
hookah.yml
source_dir: ".hookah"
source_dir_local: ".hookah-local"
hookah uninstall
FAQs
Simple git hooks manager
The npm package @arkweid/hookah-js receives a total of 1 weekly downloads. As such, @arkweid/hookah-js popularity was classified as not popular.
We found that @arkweid/hookah-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.