Giter Club home page Giter Club logo

precommit-templates's Introduction

Pre-commit-hooks Collections

pre-commit

Motivation

To facilitate starting a new project, I started to gather all the pre-commit yaml that the project will use

Introduction of pre-commit

Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks.

Ref: https://pre-commit.com

TL;DR: when developing collaboratively, we typically use git for version control and commit any changes to a feature branch that is reviewed before merging into the main codebase.

The problem is - nothing stops us from committing low-quality code to the git repository.

So to improve our code quality and unify the layout, styles etc, pre-commit hook is here to help

Installation

  • Using pip:

    $ pip install pre-commit
  • MacOS: homebrew

    brew install pre-commit
  • Conda:

    conda install -c conda-forge pre-commit

Setup & Configs

Local

You can simple copy paste one of the example in the collection folders, or run

$ pre-commit sample-config

to generate a basic config.

Then you will need to install it

$ pre-commit install

To verify the commit message, you will need to also install

$ pre-commit install --hook-type commit-msg

For morte configureation, please check https://pre-commit.com/#pre-commit-configyaml---top-level

CI/CD

To use it in CI: https://pre-commit.com/#usage-in-continuous-integration

Also, in some ci/cd services, there's already some "stage" avaiable

precommit-templates's People

Contributors

benbenbang avatar

Watchers

James Cloos avatar  avatar

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.