All Projects β†’ barzik β†’ branch-name-lint

barzik / branch-name-lint

Licence: MIT license
Lint your branch names

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to branch-name-lint

Format.cmake
πŸ’… Stylize your code! Automatic clang-format and cmake-format targets for CMake.
Stars: ✭ 94 (+56.67%)
Mutual labels:  continuous-integration, linter
action
A GitHub Action that deploys live environments for your pull requests and branches
Stars: ✭ 63 (+5%)
Mutual labels:  continuous-integration, branch
arduino-lint-action
GitHub Actions action to check Arduino projects for problems
Stars: ✭ 20 (-66.67%)
Mutual labels:  continuous-integration, linter
arduino-lint
Tool to check for problems with Arduino projects
Stars: ✭ 63 (+5%)
Mutual labels:  continuous-integration, linter
prlint
GitHub App for linting pull request meta data
Stars: ✭ 122 (+103.33%)
Mutual labels:  continuous-integration, linter
Gopherci
GopherCI was a project to help you maintain high-quality Go projects, by checking each GitHub Pull Request, for backward incompatible changes, and a suite of other third party static analysis tools.
Stars: ✭ 105 (+75%)
Mutual labels:  continuous-integration, linter
Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps πŸ“± using Github Actions πŸ’Š + Firebase Distribution πŸŽ‰
Stars: ✭ 37 (-38.33%)
Mutual labels:  continuous-integration, linter
tagref
Tagref helps you maintain cross-references in your code.
Stars: ✭ 92 (+53.33%)
Mutual labels:  continuous-integration, linter
typo3-typoscript-lint
Find coding errors in your TypoScript files.
Stars: ✭ 78 (+30%)
Mutual labels:  continuous-integration, linter
Flint
Fast and configurable filesystem (file and directory names) linter
Stars: ✭ 115 (+91.67%)
Mutual labels:  continuous-integration, linter
linter-alex
πŸ“Sensitive, considerate writing before you merge your Pull Requests
Stars: ✭ 67 (+11.67%)
Mutual labels:  continuous-integration, linter
makefiles
No description or website provided.
Stars: ✭ 23 (-61.67%)
Mutual labels:  continuous-integration, linter
cask-package-toolset.el
πŸ›  Toolsettize your emacs package! πŸ› 
Stars: ✭ 30 (-50%)
Mutual labels:  continuous-integration
verification-helper
a testing framework for snippet libraries used in competitive programming
Stars: ✭ 137 (+128.33%)
Mutual labels:  continuous-integration
elm-review
Analyzes Elm projects, to help find mistakes before your users find them.
Stars: ✭ 195 (+225%)
Mutual labels:  linter
k3ai-core
K3ai-core is the core library for the GO installer. Go installer will replace the current bash installer
Stars: ✭ 23 (-61.67%)
Mutual labels:  continuous-integration
get-cmake
Install and Cache latest CMake and ninja executables for your workflows on your GitHub
Stars: ✭ 52 (-13.33%)
Mutual labels:  continuous-integration
vscode-elixir-credo
VSCode support for Elixir Linter 'Credo'.
Stars: ✭ 20 (-66.67%)
Mutual labels:  linter
constyble
CSS complexity linter
Stars: ✭ 92 (+53.33%)
Mutual labels:  linter
golangci-lint
Fast linters Runner for Go
Stars: ✭ 11,019 (+18265%)
Mutual labels:  linter

branch-name-lint Build Status Known Vulnerabilities npm

Validating and linting the git branch name. Create a config file or use the default configuration file. Use it in husky config file to make sure that your branch will not be rejected by some pesky Jenkins branch name conventions. You may use it as part of a CI process or just as an handy npx command.

Install

$ npm install branch-name-lint

CLI usage

$ npx branch-name-lint
$ npx branch-name-lint --help

  Usage
    npx branch-name-lint [configfileLocation JSON]

  Examples
    $ branch-name-lint
    $ branch-name-lint config-file.json

CLI options.json

Any Valid JSON file with branchNameLinter attribute.

{
    "branchNameLinter": {
        "prefixes": [
            "feature",
            "hotfix",
            "release"
        ],
        "suggestions": {
            "features": "feature",
            "feat": "feature",
            "fix": "hotfix",
            "releases": "release"
        },
        "banned": [
            "wip"
        ],
        "skip": [
            "skip-ci"
        ],
        "disallowed": [
            "master",
            "develop",
            "staging"
        ],
        "separator": "/",
        "msgBranchBanned": "Branches with the name \"%s\" are not allowed.",
        "msgBranchDisallowed": "Pushing to \"%s\" is not allowed, use git-flow.",
        "msgPrefixNotAllowed": "Branch prefix \"%s\" is not allowed.",
        "msgPrefixSuggestion": "Instead of \"%s\" try \"%s\".",
        "msgseparatorRequired": "Branch \"%s\" must contain a separator \"%s\"."
    }
}

Usage with regex

In order to check the branch name with a regex you can add a a regex as a string under the branchNameLinter in your config JSON. You can also pass any options for the regex (e.g. case insensitive: 'i')

{
    "branchNameLinter": {
		"regex": "^([A-Z]+-[0-9]+.{5,70})",
        "regexOptions": "i",
		...
        "msgDoesNotMatchRegex": 'Branch "%s" does not match the allowed pattern: "%s"'
	}
}

Husky usage

After installation, just add in any husky hook as node modules call.

"husky": {
    "hooks": {
        "pre-push": "npx branch-name-lint [sample-configuration.json]"
    }
},

Usage in Node.js

const branchNameLint = require('branch-name-lint');

branchNameLint();
//=> 1 OR 0.

API

branchNameLint([options])

options

Type: object Default:

{
  prefixes: ['feature', 'hotfix', 'release'],
  suggestions: {features: 'feature', feat: 'feature', fix: 'hotfix', releases: 'release'},
  banned: ['wip'],
  skip: [],
  disallowed: ['master', 'develop', 'staging'],
  separator: '/',
  msgBranchBanned: 'Branches with the name "%s" are not allowed.',
  msgBranchDisallowed: 'Pushing to "%s" is not allowed, use git-flow.',
  msgPrefixNotAllowed: 'Branch prefix "%s" is not allowed.',
  msgPrefixSuggestion: 'Instead of "%s" try "%s".',
  msgseparatorRequired: 'Branch "%s" must contain a separator "%s".'
}

License

MIT Β© Ran Bar-Zik

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].