GithubHelp home page GithubHelp logo

danielhoherd / pre-commit-hooks Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 24 KB

A collection of pre-commit hooks I use in most of my repositories.

License: MIT License

Shell 30.68% Python 69.32%
pre-commit

pre-commit-hooks's People

Contributors

danielhoherd avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

astronomer

pre-commit-hooks's Issues

New hook: tiny files

A tool to report when tiny files are being added. Checks for line count, or character count. Maybe one hook for each. This will help people avoid committing empty files or files with truncated data that were supposed to be deleted.

Add hook: shellcheck circleci embedded commands

Write a python tool to parse commands out of circleci, write them to files, and run them through shellcheck. This will probably require using the circleci config validate command, which may be impractical. An alternative may be to abort when << circleci.variable >> type interpolations are encountered.

New hook: remove unicode quotes

Add a hook to replace unicode quotes with normal quotes. EG:

$ cat ~/code/dho-bin/fix-shitty-quotes.sh
#!/usr/bin/env bash
# shellcheck disable=SC1111
# Purpose: Remove unicode quotes from content.
# Caveats: This is just a dump search/replace. It does not account for quoted
#          content that will be misquoted after removing unicode quotes.

if [ "${#@}" -lt 1 ]; then
    echo "Replaces shitty quotes with normal quotes in all given files"
    echo "example: grep -rl '[“”’]' | xargs ${0##*/}"
    exit 1
fi

if [ "$(uname)" == 'Darwin' ]; then
    [ ! -e /usr/local/bin/gsed ] && {
        echo "GNU sed is required because bsd sed is lame."
        exit 1
    }
    /usr/local/bin/gsed -i 's/[“”]/"/g' "$@"
    /usr/local/bin/gsed -i "s/’/'/g" "$@"
else
    sed -i 's/[“”]/"/g' "$@"
    sed -i "s/’/'/g" "$@"
fi

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.