barzik / branch-name-lint

Lint your branch names

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow an arbitrary branch pattern generated by a tool

deevus opened this issue · comments

I'm using an automated tool (Laravel Shift) that automatically creates a pull request with a branch name like shift-ci-v8.70.2. There is usually some manual intervention required so I pull down the branch and make some changes and try to push it, but I am blocked by branch-name-lint:

Branch name lint fail! Branch "shift-ci-v8.70.2" must contain a separator "/".

Here is my config:

{
  "branchNameLinter": {
    "prefixes": [
      "feature",
      "issue",
      "hotfix",
      "release",
      "support"
    ],
    "regex": "^(revert|master|develop|issue|release|hotfix/|feature/|support/|shift-)"
  }
}

The regex does handle it, but there doesn't appear to be any way to skip the separator check.

if (this.branch.includes(this.options.separator) === false) {
return this.error(this.options.msgseparatorRequired, this.branch, this.options.separator);
}

Would you be open to a PR that allows disabling of checks by setting their config value to false?

{
  "branchNameLinter": {
    "prefixes": false,
    "separator": false,
    "regex": "^(revert|master|develop|issue|release|hotfix/|feature/|support/|shift-)"
  }
}

That would allow the end user to configure any scheme they like using regex.