Code Monkey home page Code Monkey logo

careful's Introduction

careful

version downloads MIT License

Provides a binary that can be used as a git-hook to validate branch names according to git-flow prior to pushing upstream.

$ (features/banned-regex-support) careful

CAREFUL! Branch prefix "features" is not allowed.
CAREFUL! Instead of "features/banned-regex-support" try "feature/banned-regex-support".

Features

  • Validate branch name according to default git-flow format.
  • Prevent pushes to certain branches such as master or staging.
  • Completely customizable, from prefix seperator to the error messages themselves.
  • Give suggestions when prefixes don't exist.

Installation

$ npm install careful --save-dev
  • Use ghooks to setup pre-push and pre-commit git hooks. Requires git 1.8.2+
  • Use -g to install globally to get careful command everywhere.

Usage

Options

Define options in your package.json file (values displayed below are the default values):

{
  "config": {
    "careful": {
      // Allowed git-flow prefixes (e.g. <prefix>/<name>)
      // Example: feature/banned-regex-support
      "prefixes": ["feature", "hotfix", "release"],

      // Commonly misspelled or forgotten?
      // Add a suggestion for when it occurs
      "suggestions": {
        "features": "feature",
        "feat": "feature",
        "fix": "hotfix",
        "releases": "release"
      },

      // Skip validation check completely for certain branches
      // MUST be full branch name including prefixes
      "skip": [],
      
      // Branches developers are disallowed to push code
      // MUST be full branch name including prefixes
      "disallowed": ["master", "staging", "develop"],

      // Ban a branch name completely from being used regardless of prefix
      "banned": ["wip"],

      // Prefix to name seperator
      "seperator": "/"
    }
  }
}

skip

Skip all checks for certain branches.

prefixes

git-flow branch prefixes allowed.

suggestions

Give suggestions when a certain prefix is used.

Instead of "features/banned-regex-support" try "feature/banned-regex-support"

disallowed

Prevent pushing to certain branches, must be the entire branch name, including prefixes.

seperator

Character used to seperate the prefix and branch name. Defaults to /, as Sourcetree converts branch names that use / into folders.

banned

Ban pushing to branches with a certain name. Checks both complete branch name, and the name of the branch with the prefix omitted.

msgBranchBanned

Message displayed when a banned branch name is used.

msgPrefixNotAllowed

Message displayed when a prefix that is not allowed is used.

msgPrefixSuggestion

Message displayed when a suggestion for a prefix exists.

msgSeperatorRequired

Message displayed when the branch is missing the seperator.

License

MIT

careful's People

Contributors

nijikokun avatar therebelrobot 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.