Ready is a program to run tasks before a commit using a pre-commit git hook.

Ready

Ready is a program to run tasks before a commit using a pre-commit git hook.

For example, you can automatically run formatting, linting, and testing when running git commit, so you are assured every commit is up to the standards, issues are spotted early, and to avoid any CI pipeline failures down the road.

For now, tasks are run on all the repository files, not just the staged ones.

At any time, tasks can be run without committing by running ready.

Additionally, to commit without running any task, the -n/--no-verify git commit flag can be used.

Instructions

  1. Install Ready
go install github.com/lewislbr/ready@latest
  1. Install hook

Must be run in the repository root path (where the folder .git is located).

ready init

This will check for any existing pre-commit hook, and if found, it will prompt to override it or abort the process. If no hook is found, a new one with execution rights will be created.

  1. Create tasks file

File must be named ready.yaml and placed in the repository root path (where the folder .git is located).

tasks:
  - name: format
    command: gofumpt -l -w .
  - name: lint
    command: golangci-lint run

By default, commands will be run in the root directory, but they can be scoped to nested directories:

tasks:
  - name: format
    command: gofumpt -l -w . # This will run in the root directory (./)
  - name: lint
    directory: app-1
    command: golangci-lint run # This will run in the app-1 directory (./app-1)
  - name: lint
    directory: app-2
    command: golangci-lint run # This will run in the app-2 directory (./app-2)

YAML file reference

tasks: # Array of tasks to be run (required)
  - name: format # Name of the task (required)
    directory: app-1 # Directory where to run the command (optional)
    command: gofumpt -l -w . # Command to run (required)

Example

example-fail

example-success

Contributing

This project started as a way to learn and to solve a need I had. If you think it can be improved in any way, you are very welcome to contribute!

Owner
Lewis Llobera
Software engineer at Flyt. Previously: METRO Markets, trivago.
Lewis Llobera
Similar Resources

Gogs is a painless self-hosted Git service

Gogs is a painless self-hosted Git service

Gogs - A painless self-hosted Git service 简体中文 🔮 Vision The Gogs (/gɑgz/) project aims to build a simple, stable and extensible self-hosted Git servi

Jan 9, 2023

A highly extensible Git implementation in pure Go.

A highly extensible Git implementation in pure Go.

go-git is a highly extensible git implementation library written in pure Go. It can be used to manipulate git repositories at low level (plumbing) or

Jan 8, 2023

A command-line tool that makes git easier to use with GitHub.

hub is a command line tool that wraps git in order to extend it with extra features and commands that make working with GitHub easier. For an official

Jan 1, 2023

A tool to monitor git repositories and automatically pull & push changes

git-o-matic A tool to monitor git repositories and automatically pull & push changes Installation Packages & Binaries Arch Linux: gitomatic Binaries f

Dec 20, 2022

SQL interface to git repositories, written in Go. https://docs.sourced.tech/gitbase

gitbase gitbase, is a SQL database interface to Git repositories. This project is now part of source{d} Community Edition, which provides the simplest

Dec 25, 2022

Fast and powerful Git hooks manager for any type of projects.

Fast and powerful Git hooks manager for any type of projects.

Lefthook The fastest polyglot Git hooks manager out there Fast and powerful Git hooks manager for Node.js, Ruby or any other type of projects. Fast. I

Jan 4, 2023

Implementation of git internals from scratch in Go language

Implementation of git internals from scratch in Go language

This project is part of a learning exercise to implement a subset of "git" commands. It can be used to create and maintain git objects, such as blobs, trees, commits, references and tags.

Nov 27, 2022

A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI

A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI

A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. Abstract Trivy (tri pronounced like trigger, vy

Jan 9, 2023

go mod vendor lets you check in your dependencies to git, but that's both bloaty (for developers) and tedious (remembering to update it).

go-mod-archiver Afraid of being unable to build historical versions of your Go program? go mod vendor lets you check in your dependencies to git, but

Dec 1, 2022
Comments
  • he system cannot find the path specified

    he system cannot find the path specified

    Hello

    I'm getting this error when i try to commit.

    am using

    • [ ] windows 10
    • [ ] go version go1.17.3 windows/amd64

    Error

    git commit -m "config in progress.. :rocket:"
    2021/11/15 00:02:55 Failed to get config: reading file: open \c\personal\projects\uni-blog\ready.yaml: The system cannot find the path specified.
    

    my ready.yaml

    tasks:
      - name: format
        command: gofumpt -extra -l -w .
    

    any help please?

    Thanks in advance
    am using this go template

  • [enhancement] change default git hook directory

    [enhancement] change default git hook directory

    The program hard codes the "./.git/hooks/pre-commit" directory to create hooks. This issue is a suggestion to make this repository parametrizable in order to use hooks sharing techniques.

  • Added cross platform artifact generation

    Added cross platform artifact generation

    Hello Lewis,

    I was watching DevOps Paradox and there, @vfarcic mentioned that "ready binaries could be helpful" And I thought that maybe this can be helpful. :)

    https://www.youtube.com/watch?v=XoqgciDvZ3Y

A great util to format you git commit message!
A great util to format you git commit message!

A great util to format you git commit message!

Dec 2, 2021
Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Jan 2, 2023
ReGit: A Tiny Git-Compatible Git Implementation written in Golang

ReGit is a tiny Git implementation written in Golang. It uses the same underlying file formats as Git. Therefore, all the changes made by ReGit can be checked by Git.

Oct 31, 2022
A Git RPC service for handling all the git calls made by GitLab
A Git RPC service for handling all the git calls made by GitLab

Quick Links: Roadmap | Want to Contribute? | GitLab Gitaly Issues | GitLab Gitaly Merge Requests | Gitaly is a Git RPC service for handling all the gi

Nov 13, 2021
A simple cli tool for switching git user easily inspired by Git-User-Switch
A simple cli tool for switching git user easily inspired by Git-User-Switch

gitsu A simple cli tool for switching git user easily inspired by Git-User-Switch Installation Binary releases are here. Homebrew brew install matsuyo

Dec 31, 2022
Removes unnecessarily saved git objects to optimize the size of the .git directory.

Git Repo Cleaner Optimizes the size of the .git directory by removing all of the files that are unnecessarily-still-saved as part of the git history.

Mar 24, 2022
Gum - Git User Manager (GUM) - Switch between git user profiles
Gum - Git User Manager (GUM) - Switch between git user profiles

Git User Manager (GUM) Add your profile info to config.yaml Build project: go bu

Feb 14, 2022
Git-now-playing - Git commits are the new AIM status messages

git-now-playing git-now-playing is an attempt to bring some of the panache of th

Apr 4, 2022
Suppress commit to master and development, merge branch to master and development

git-extension masterと名前のつくブランチをマージするのは禁止 masterとdevelopmentブランチに直接commitやmergeするのは禁止 masterブランチを親に新規ブランチを作成するのは禁止 どうしてもmasterやdevelopmentブランチに操作をしたい時は

Nov 8, 2021
Go-commitlinter - simple commit message linter
Go-commitlinter - simple commit message linter

go-commitlinter go-commitlinter is simple commit message linter. Quick Start go

Oct 8, 2022