Giter Site home page Giter Site logo

ready's Introduction

Ready

Ready is a program to run tasks on staged files 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.

Tasks are run when there are staged files, by default on the repository root folder or on other folders if specified.

At any time, tasks can be run without committing by running ready. If there are no staged files, no tasks will be run, but you can use ready -all to run all tasks even when no staged files exist.

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

Instructions

  1. Install Ready

You can use Go:

go install github.com/lewislbr/ready@latest

Or download the binary from the releases page and place it in your $PATH.

  1. Install hook

Run ready init 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

Create a file named ready.yaml and place it 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 with the directory option:

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!

ready's People

Contributors

lewislbr avatar omerkarabacak avatar raliqala avatar

Stargazers

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

Watchers

 avatar  avatar

ready's Issues

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

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.