All Projects → ddddavidmartin → Pre Commit Hooks

ddddavidmartin / Pre Commit Hooks

Licence: bsd-2-clause
A set of useful (and documented!) git pre-commit hooks.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Pre Commit Hooks

Xo
❤️ JavaScript/TypeScript linter (ESLint wrapper) with great defaults
Stars: ✭ 6,277 (+6507.37%)
Mutual labels:  linter, best-practices
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (-29.47%)
Mutual labels:  best-practices, linter
Git Good Commit
Git hook to help you write good commit messages, with no external dependencies.
Stars: ✭ 128 (+34.74%)
Mutual labels:  hooks, best-practices
Swift-Coding-Guidelines
A repository to collect best practices when programming with Swift
Stars: ✭ 17 (-82.11%)
Mutual labels:  best-practices, linter
Go Consistent
Source code analyzer that helps you to make your Go programs more consistent.
Stars: ✭ 293 (+208.42%)
Mutual labels:  linter, best-practices
Wotan
Pluggable TypeScript and JavaScript linter
Stars: ✭ 271 (+185.26%)
Mutual labels:  linter, best-practices
rubocop-graphql
Rubocop extension for enforcing graphql-ruby best practices
Stars: ✭ 143 (+50.53%)
Mutual labels:  best-practices, linter
Clusterlint
A best practices checker for Kubernetes clusters. 🤠
Stars: ✭ 409 (+330.53%)
Mutual labels:  linter, best-practices
Validator
Nu Html Checker – Helps you catch problems in your HTML/CSS/SVG
Stars: ✭ 1,024 (+977.89%)
Mutual labels:  linter, best-practices
React Ufo
🛸 react-ufo - A simple React hook to help you with data fetching 🛸
Stars: ✭ 85 (-10.53%)
Mutual labels:  hooks
Qa Best Practices
This is a summary of QA practices Futurice uses and recommends to be used.
Stars: ✭ 88 (-7.37%)
Mutual labels:  best-practices
Laravel Blog
Laravel 8.0 blog application with Vue.js, Homestead, Horizon, Telescope and Pusher
Stars: ✭ 1,248 (+1213.68%)
Mutual labels:  best-practices
Git Style Guide
A git style guide.
Stars: ✭ 86 (-9.47%)
Mutual labels:  best-practices
Rubberduck
Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
Stars: ✭ 1,287 (+1254.74%)
Mutual labels:  linter
React Selector Hooks
Collection of hook-based memoized selector factories for declarations outside of render.
Stars: ✭ 84 (-11.58%)
Mutual labels:  hooks
React Anime
✨ (ノ´ヮ´)ノ*:・゚✧ A super easy animation library for React!
Stars: ✭ 1,313 (+1282.11%)
Mutual labels:  hooks
Hook Flow
A flowchart that explains the new lifecycle of a Hooks component. https://dwe.st/hf
Stars: ✭ 1,246 (+1211.58%)
Mutual labels:  hooks
Go Best Practice
Go语言实战: 编写可维护Go语言代码建议
Stars: ✭ 1,240 (+1205.26%)
Mutual labels:  best-practices
Platform Samples
A public place for all platform sample projects.
Stars: ✭ 1,328 (+1297.89%)
Mutual labels:  hooks
Dahlia
An opinionated React Framework. [Rename to pea.js]
Stars: ✭ 92 (-3.16%)
Mutual labels:  hooks

This repository contains some useful and documented pre-commit hooks to use with git.

NOTE: The scripts in this repository are currently not actively being developed. They have served me well though and work as they are. pre-commit.com looks like a well-maintained alternative with a similar approach. Also, live linters like w0rp/ale are pretty awesome!

Table of contents

Included hooks

hook description
pre-commit Allow to run multiple pre-commit hooks as specified in the script.
pre-commit-compile Compile the project and abort commit if it fails.
pre-commit-uncrustify Run Uncrustify on your sourcefiles and abort the commit if style violations have been detected. Generate a patch to fix these violations.

Features

  • Shell agnostic, should work with any Posix compliant shell
  • Robust against whitespaces and special characters in file names and directories
  • Tested on Linux and Mac OS
  • The hooks can easily be extended and run side by side with existing ones

Usage example

Sometimes pictures say more than a thousand words. Below is an exemplary workflow using the Uncrustify hook.

  • Add or edit a file and work on some code

Work on code

  • Stage changes

Add changes

  • Attempt to commit changes

Commit changes

  • Apply the automatically created patch to fix the formatting

Apply patch

  • Commit again

Commit changes again

Installation

  1. Clone the repository

    git clone git://github.com/ddddavidmartin/Pre-commit-hooks.git
    cd Pre-commit-hooks
    
  2. Every script comes with a <script>.example.cfg configuration file. Here you will find relevant configuration options. For starters create a pre-commit.cfg and update the configuration section in it with the hooks that you want to install and use.

    cp pre-commit.example.cfg pre-commit.cfg
    vim pre-commit.cfg  # update with desired hooks
    
  3. Copy the pre-commit hooks into your repository. Note that the script will ask before overwriting any existing hooks. By default it installs the example config for each hook.

    ./install_hooks.sh /path/to/repository
    
  4. The pre-commit hooks live in the .git/hooks subdirectory of your git repository. Update their configuration files if required and you are good to go. By default the hooks will abort the commit and print a notice if any required configuration is missing.

  5. Work on your code as usual and the hooks should be run automatically when calling git commit.

  6. Profit!

Contributions

Thanks to everyone who contributed with fixes, ideas and extensions!

Feel free to open issues or pull requests if you come across something that can be improved or does not work. Input is always appreciated.

License

Licensed as per LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].