Git Product home page Git Product logo

git.hooks's Introduction

Git Hooks

Features

  • 代码提交前对缓存区中的 Python 文件进行自动语法检查(pyflakes)、 代码规范检查(pep8)、 单元测试(仅运行缓存区中的测试文件)。
  • 代码推送前运行完整的单元测试。
  • 代码推送成功后会重启服务器等。

pre-commit

提交代码前,实现了自动语法检查,代码规范,单元测试。

如果提交的代码存在语法错误,是必然不会被提交的。pre-commit 会将错误信息打印出来并拒绝提交;若不是严重的语法错误,而是有一些代码规范的问题,pre-commit 会询问提交者是否停止提交,修正错误;为了代码风格一致,这里建议进行修正。

如果本次提交中有修改或新加单元测试文件,pre-commit 会运行这些被修改的测试文件的单元测试,如果不能顺利通过,提交动作也会被拒绝。

Requirement

  • pyflakes

    pip install pyflakes

  • pep8

    pip intall pep8

  • nosetests

pre-receive

向服务器推送代码前,运行全部的单元测试。 该脚本是放在服务端的。

post-receive

推送完成后,进行编译(coffeescript, less 等),重启服务器等。

Installing

将钩子脚本添加到项目目录下的 .git/hooks/ 目录下。并确认脚本有可执行权限。

git.hooks's People

Contributors

tonsh avatar acmerfight 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.