Coder Social home page Coder Social logo

husky's Introduction

Husky

GoDoc Widget codecov Go Report Card

Husky.js like, but pure in golang

Usage

install

go install github.com/go-courier/husky/cmd/husky@latest

install git hooks

husky init

Configuration .husky.toml

.husky.yaml supported too.

# version-file which will write or read current semver
version-file = "internal/version/version"

# hook scripts
[hooks]

# after version calc,
# with use the {{ .Version }} to upgrade other files.
post-version = [
    "sed -i -e 's/\"version\": \"[^\"]*\"/\"version\": \"{{ .Version }}\"/g' testdata/package.json",
    "sed -i -e 's/version: [^\\n]*/version: {{ .Version }}/g' testdata/pubspec.yaml"
]

# git hook pre commit
pre-commit = [
    "golangci-lint run",
    "husky lint-staged",
]

# git hook commit msg
commit-msg = [
    "husky lint-commit",
]

# list staged files do some pre-process and git add
[lint-staged]
"*.go" = [
    "goimports -l -w",
    "gofmt -l -w",
]

# commit msg rule default support conventional commits
[lint-commit]
# could check if this exists
# email = "^([email protected]|[email protected])$"
# optional custom types check regex
# types = "^(feat|fix|build|chore|ci|docs|perf|refactor|revert|style|test)$"
# optional header check regex
# header = "^(?P<type>\w+)(\((?P<scope>[\w/.-]+)\))?(?P<breaking>!)?:( +)?(?P<header>.+)"

Commit msg rule follow https://www.conventionalcommits.org/en/v1.0.0/

type(scope?): header

body?

footer?

husky's People

Contributors

dependabot[bot] avatar franklinkim avatar goober avatar morlay avatar renovate-bot avatar tangx avatar that-coder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

husky's Issues

How do I fail to commit

Add exit 1 to my yaml file in hook

hooks:
  pre-commit:
    - exit 1

But no effect
How do I fail to submit?

Stack overflow error if the folder is not a git reository

Problem

Today, I installed husky and run husky init, but I forgot to run git init, so husky init was failed with the stack overflow error.

Request

As a developer, I want husky init to print a meaningful error message for the above situation instead of a stack trace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.