GithubHelp home page GithubHelp logo

yazan98 / commiter Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 218 KB

Ruby Cli To Block Git Commits if you wrote Bad Messages

License: MIT License

Ruby 99.34% Shell 0.66%
github-config git-hooks git-hook git-history validation commit-message commits ruby ruby-cli cli validations configuration

commiter's Introduction

Commiter

Description

Commiter is a Cli Written in Ruby To Ask some Questions about how you want to write the commit message validation before write any commit and if this commit is not matching the commiter configuration file it will reject the commit and kill the process

Project Development

This Project Designed Like this to Match any Project or language i will work on for this reason it has External files should be inside Hooks Manually to match any type of Projects and it's not connected to a specific language configuration

The Problem

In each git Repository when you initialize the Project you dont have Rules to make All Developers inside this Project Follow same way in Commit Messages and in the Future if you cant find any key inside the messages to see the history you will never know how this feature implemented like this until you deep dive into it because you dont have the main reason about this area you just found the commit message (fix) and this is not a commit message :D so with this configuration all the team will have same commit rules and if someone is not following this rules the commit will be rejected

Screenshots for Validation

  1. Ticket Number Validation

The Use case Here is when i work on Large Project i Use This Technique to Connect Everything with a Ticket Number so i can return whenever i want inside History and know exactly this change for any ticket Capture

  1. Black list Validation

The Use case Here is when i work on a repo sometimes i write Dummy Messages and this will remind me if i wrote same message again :D Capture

  1. Regex Expression Validation

The Use case Here is a Customized way to Put any Pattern you want if it not already Supported Capture

  1. Subject and Content Validation

The Use Case Here some Project dont have Task Management Project so There is no Ticket Number Here So this Technique Will be Good when you Write Subject : Content Meaningful Message subject_validation

Validations Supported

  1. Ticket Number
  2. Black List Words
  3. Regex Expression
  4. Subject : Content

Installation

  1. Ruby Required
  2. Bundler To Fetch Gem

Include in Another Supported Ruby Project

  1. Create File in your Root Directory inside The Project (Gemfile)
  2. Add This Line at the First
source 'https://rubygems.org'
  1. Add this Line inside This File RubyGem Link
gem 'commiter', '~> 1.0.0'
  1. Run this Commands
gem install commiter
bundle install
bundle package
  1. Copy commiter gem file From Vendor Directory to your Project

Quick Installation

If you dont wanna use gem file you can copy the files and Edit the Config json File from result folder into you .git/hooks folder inside your git repository you will find variables described in table section

In this Step you dont need to Edit Your Project Source Code you just copy the Files to git Configuration

Key Name Description
is_enabled Decide if commit command will check the validation or not
ticket_number_example What is the Ticket Number Key like SW-{#} The {#} is the Dynamic Number Value
generated_style You Have 3 Options To Validation (t -> Ticket Number) / (b -> Black List Words) / (r -> Regex Expression)
regex_input The Regex String to match Message with it if the generated style (r) is Selected
black_list_words The Black list words Blocked

Cli

This Project is a Command line Interface to Generate this File inside your git file If you want to Install the Cli Clone this Repo then install ruby and run this command inside the Project

rake install -g

The Cli should be started

Capture

Todo List

  1. Support Restore Point In Cli To Generate Git Hooks from Config Json File
  2. Support 2 Types in the same time in Validations like Regex and Black list
  3. Run Command Before push commit like Code Analysis Then Execute Commit Message Validation

commiter's People

Contributors

yazan98 avatar

Stargazers

 avatar  avatar

Watchers

 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.