Coder Social home page Coder Social logo

git-commit's Introduction

git-commit

Go Report Card Maintainability codebeat badge FOSSA Status

This project is a configurable commit-msg hook. You can either configure using a global configuration file of a repository configuration file. If both exist, repository file will be merged into global configuration file.

The global configuration file is located in the HOME directory of the user and named .commit-hook.yaml while the repository specific file is in the root of the repository and named .commit-hook.yaml.

Both files have the same structure.

Configuration file structure

---

version: 2                           # version of config file

subject-line-length: 50              # Length of the subject line at a maximum
body-required: false                 # Is a body required for a commit
separate-body: true                  # Should the body be separated by a blank line
body-line-length: 72                 # Maximum length of body lines
enforce-body-line-length: true       # Should too long body lines be treated as an error or as a warning
lint_gitlab_ci: true                 # If true this calls out to lint .gitlab-ci.yml files
gitlab_ci_file: relativePath         # Set a different CI file location
confd-directories                    # Specify whether .commit-msg.d directory is used

ignore:                              # a list of regular expressions to ignore lines (no check)
  - ^#.*                             # ignore comments

subject:                                         # Match the subject against those expressions
  - name: ensure tagging of subject              # Name of rule
    expression: ^[a-z]+(\([a-z]+\))?:.*[^\.]$    # have feat(web): bla match, no . at the end allowed
    severity: error                              # on error fail commit, else print with severity attached

occurs:                              # Match somewhere, check for existence
  - TICKET-[0-9]+                    # have a TICKET-1 as a match

external-tools:                      # external tools to run before accepting commit
  - severity: error                  # on error fail commit, else print with severity attached
    name: linter                     # name of rule
    command:                         # command to execute
      - make
      - lint

Installation

Put the binary into your path. If you want to use GitLab CI linting you need to use: https://gitlab.com/orobardet/gitlab-ci-linter

Use

install hook

The application has a helper to install the hook:

git-hook-commit install

You need to run this in the root of your project ( the folder containing the .git folder ). If there is an existing hook you have to force it ( -f ).

uninstall hook

Similar to the installation process, there is an uninstall helper:

git-hook-commit uninstall

Essentially this just removes the hook, so it would remove any other hook also. So be careful.

History

Version Description
1.1.0 Add support for conf.d directory
1.0.1 better gitlab ci handling
1.0.0 update to use go modules
0.9.0 add support for GitLab CI linter
fix a bug where body lines where multiplied by the number of ignore expressions
0.8.0 add support for Co-authored-by
0.7.0 rename binary
0.6.2 code quality improvements
0.6.1 code quality improvements
0.6.0 remove v1
run external tools
fix: version check
0.5.0 version 2 of configuration
Naming of rules
Severity for rules
0.4.0 add version to config file
0.3.1 integration with code quality tools
0.3.0 print version information
0.2.0 configuration file is now named .commit-hook.yaml
fix: project configuration now correctly located in repository root
fix: run subject line length
0.1.0 Initial version

License

FOSSA Status

git-commit's People

Contributors

fossabot avatar sascha-andres avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fossabot x3c3

git-commit's Issues

run external programs

Description

Allow running a list of external program (such as linters) to have external validations

add version 2

Description

add a new version of config file to be able to work on other issues like #3 and #4

Versions

< 0.5.0

print version

when started print an info line with the current version on it

if one file has no version version mismatch is assumed

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem

Description

if one of the configurations has no version an error is emitted instead of

Steps to Reproduce

  1. add a version to global config
  2. ensure local config has no version
  3. run git commit

Expected behavior:

a running hook

Actual behavior:

error about version mismatch

Reproduces how often:

everytime

Versions

0.4.0

provide name for rule

instead of writing out the regular expression that did not match we can write out a more human readable information

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.