Go-commitlinter - simple commit message linter

go-commitlinter

go-commitlinter is simple commit message linter.

Sample Image

Quick Start

> .git/hooks/commit-msg chmod 755 .git/hooks/commit-msg">
go install github.com/masahiro331/[email protected]
echo "go-commitlinter" >> .git/hooks/commit-msg
chmod 755 .git/hooks/commit-msg

Description

The go-commitlinter will detect and fail a commit message that is not in the following format.


   
    (
    
     ): 
     

     
    
   

The type and scope should always be lowercase as shown below.
The can be empty (e.g. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.

Allowed values:

  • feat for a new feature for the user, not a new feature for build script.
  • fix for a bug fix for the user, not a fix to a build script.
  • perf for performance improvements.
  • docs for changes to the documentation.
  • style for formatting changes, missing semicolons, etc.
  • refactor for refactoring production code, e.g. renaming a variable.
  • test for adding missing tests, refactoring tests; no production code change.
  • build for updating build configuration, development tools or other changes irrelevant to the user.
  • chore for updates that do not apply to the above, such as dependency updates.

example:

  • parser
  • controller
  • some package namespace
  • etc...

Other use cases

For example, if you want to validate the title of a pull request.
Add the following github actions workflow.

name: Test
on:
  pull_request:
env:
  GO_VERSION: "1.17"
jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Go pull request message linter
        uses: masahiro331/[email protected]
        env:
          PR: ${{ github.event.number }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Custom Rules

This tool is able to custom rules.

go-commitlinter -rule rule.yaml

This is default rules.

skip_prefixes:
  - 'Merge branch '
  - 'BREAKING: '
type_rules:
  - type: feat
    description: for a new feature for the user, not a new feature for build script.
  - type: fix
    description: for a bug fix for the user, not a fix to a build script.
  - type: perf
    description: for performance improvements.
  - type: docs
    description: for changes to the documentation.
  - type: style
    description: for formatting changes, missing semicolons, etc.
  - type: refactor
    description: for refactoring production code, e.g. renaming a variable.
  - type: test
    description: for adding missing tests, refactoring tests; no production code change.
  - type: build
    description: for updating build configuration, development tools or other changes irrelevant to the user.
  - type: chore
    description: for updates that do not apply to the above, such as dependency updates.
reference: https://github.com/masahiro331/go-commitlinter#description
style_doc: The type and scope should always be lowercase.
scope_doc: The 
   
     can be empty (e.g. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.
subject_doc: The first letter of 
    
      should be lowercase.

    
   
  • skip_prefixes: Use skip some titles. for example, merge commit "Merge branch 'main' of ....."
  • type_rules: Use it to add your own type.
  • reference: Include a link to the CONTRIBUTING GUILD.
  • style_doc: Describe the specifications of style.
  • scope_doc: Describe the specifications of scope.
  • subject_doc: Describe the specifications of subject.
Owner
Masahiro331
Sorry, I'm not good at English. I may write some terrible expressions.
Masahiro331
Similar Resources

Git Add Commit - Commit made easy

 Git Add Commit - Commit made easy

Git Add Commit Commit made easy Installation Download the latest release and put the binary in your $PATH Homebrew: brew tap rawnly/tap brew i

Jul 26, 2022

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter Prometheus Common Data Exporter 用于将多种来源(如http响应报文、本地文件、TCP响应报文、UDP响应报文)的Json、xml、yaml或其它格式的数据,解析为Prometheus metric数据。

May 18, 2022

Enforce git message commit consistency

Enforce git message commit consistency

Gommit Gommit analyze commits messages to ensure they follow defined pattern. Summary Setup Usage Practical Usage Third Part Libraries Setup Download

Jan 4, 2023

github-actions-merger is github actions that merges pull request with commit message including pull request labels.

github-actions-merger github-actions-merger is github actions that merges pull request with commit message including pull request labels. Usage Write

Dec 7, 2022

A great util to format you git commit message!

A great util to format you git commit message!

A great util to format you git commit message!

Dec 2, 2021

A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem

A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem

COMMIT CLI A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem. And yes, it is bui

Feb 9, 2022

Linter for Go's fmt.Errorf message

wrapmsg wrapmsg is Go code linter. this enforces fmt.Errorf's message when you wrap error. Example // OK 👍🏻 if err := pkg.Cause(); err != nil { re

Dec 27, 2022

Alertmanager go message broker - A simple message broker made to integrate with alertmanager/prometheus

Alertmanager message broker Prerequisites Go 1.16+ Sqllite driver About: The alertmanager message broker is a project made to meet some of my needs to

Dec 27, 2021

A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets.

ozzo-log Other languages 简体中文 Русский Description ozzo-log is a Go package providing enhanced logging support for Go programs. It has the following fe

Dec 17, 2022

Provide cloud-edge message synergy solutions for companies and individuals.the cloud-edge message system based on NATS.

Swarm This project is a cloud-edge synergy solution based on NATS. quikly deploy cloud deploy on k8s #pull the project. git clone https://github.com/g

Jan 11, 2022

Priority queue with message-group based partitioning and equal attention guarantee for each message group based on Redis

redis-ordered-queue-go Priority queue with message-group based partitioning and equal attention guarantee for each message group based on Redis What i

Oct 21, 2022

Display last GitLab project git commit. Page is optimized for an e-paper device.

Display last GitLab project git commit. Page is optimized for an e-paper device.

git-on-epaper A gitlab webhook for push notifications on a project. The webhook serves a HTML that shows the last push on the project with the followi

Dec 12, 2022

commit/branch/workdir explorer for git

gitin gitin is a commit/branch/status explorer for git gitin is a minimalist tool that lets you explore a git repository from the command line. You ca

Dec 21, 2022

commit/branch/workdir explorer for git

gitin gitin is a commit/branch/status explorer for git gitin is a minimalist tool that lets you explore a git repository from the command line. You ca

Dec 31, 2022

Extended ssh-agent which supports git commit signing over ssh

ssh-agentx ssh-agentx Rationale Requirements Configuration ssh-agentx Configuration ssh-gpg-signer Linux Windows Signing commits after configuration T

Jun 29, 2022

Semantic version generator using git commit keywords and overrides

Semantic version generator Project created overnight, to prove that management of semantic versioning is NOT painful and do not require arguments and

Jan 1, 2023

Suppress commit to master and development, merge branch to master and development

git-extension masterと名前のつくブランチをマージするのは禁止 masterとdevelopmentブランチに直接commitやmergeするのは禁止 masterブランチを親に新規ブランチを作成するのは禁止 どうしてもmasterやdevelopmentブランチに操作をしたい時は

Nov 8, 2021

🏗️ Fetch a specific commit without any history (shallow depth w/o cloning)

shallow-fetch-sha 🏗️ For a given git repository and commit, fetch and checkout just that commit without any history. This can be extremely useful in

Nov 27, 2021

A distributed append only commit log used for quick writes and reads to any scale

A distributed append only commit log used for quick writes and reads to any scale

Maestro-DB A distributed append only commit log used for quick writes and reads to any scale Part 1 - Scaffolding Part-1 Notes Going to start off with

Nov 28, 2021
Related tags
A great util to format you git commit message!
A great util to format you git commit message!

A great util to format you git commit message!

Dec 2, 2021
commit/branch/workdir explorer for git

gitin gitin is a commit/branch/status explorer for git gitin is a minimalist tool that lets you explore a git repository from the command line. You ca

Dec 31, 2022
Suppress commit to master and development, merge branch to master and development

git-extension masterと名前のつくブランチをマージするのは禁止 masterとdevelopmentブランチに直接commitやmergeするのは禁止 masterブランチを親に新規ブランチを作成するのは禁止 どうしてもmasterやdevelopmentブランチに操作をしたい時は

Nov 8, 2021
A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

Dec 28, 2022
A simple tool to help apply changes across many GitHub repositories simultaneously
A simple tool to help apply changes across many GitHub repositories simultaneously

A simple tool to help apply changes across many GitHub repositories simultaneously

Dec 22, 2022
A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI
A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI

A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. Abstract Trivy (tri pronounced like trigger, vy

Jan 9, 2023
Simple git hooks written in go that installs globally to your machine

Go-hooks Simple git hooks written in go that installs globally to your machine Install curl -fsSL

Oct 19, 2022
🥄A simple generator for semantic git messages.

?? Tablespoon EXPERIMENTAL PREVIEW A simple generator for semantic git messages. Installation | Contributing Tablespoon is a simple generator which ca

Jul 22, 2022
A simple cli tool for switching git user easily inspired by Git-User-Switch
A simple cli tool for switching git user easily inspired by Git-User-Switch

gitsu A simple cli tool for switching git user easily inspired by Git-User-Switch Installation Binary releases are here. Homebrew brew install matsuyo

Dec 31, 2022
Ready is a program to run tasks before a commit using a pre-commit git hook.
Ready is a program to run tasks before a commit using a pre-commit git hook.

Ready Ready is a program to run tasks before a commit using a pre-commit git hook. For example, you can automatically run formatting, linting, and tes

Aug 23, 2022