New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

careful

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

careful

Validate git branch names according to git-flow


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created

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

FAQs

Package last updated on 30 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts