Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
branch-name-lint
Advanced tools
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.
$ npm install branch-name-lint
$ 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
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\"."
}
}
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"'
}
}
After installation, just add in any husky hook as node modules call.
"husky": {
"hooks": {
"pre-push": "npx branch-name-lint [sample-configuration.json]"
}
},
const branchNameLint = require('branch-name-lint');
branchNameLint();
//=> 1 OR 0.
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".'
}
MIT © Ran Bar-Zik
FAQs
Lint your branch names
The npm package branch-name-lint receives a total of 4,219 weekly downloads. As such, branch-name-lint popularity was classified as popular.
We found that branch-name-lint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.