Skip to content

Allow user-defined patterns #44

@gibson042

Description

@gibson042

For example, to require subject lines consisting of semver level, one or more repository-specific components (separated by commas or comma-space pairs and ending with a colon), and a non-empty sentence-case message, all of which must be separated by spaces:

"commitplease": {
  // Braces like http://tools.ietf.org/html/rfc6570 URI Template expressions
  // Expression syntax like https://tools.ietf.org/html/rfc5234#section-3.6 ABNF repetition
  // …with introduction of optional separator definition in ECMAScript RegExp syntax
  "subjectPattern": "{semver-level} {1* ,[\\x20]? components}: {message}",

  // Variables are usually arrays of acceptable values
  "semver-level": [ "major", "minor", "patch" ],
  "components": [ "Build", "Test", "Core", "Legacy" ],

  // Variables can also be ECMAScript regular expressions in ESTree format
  // https://github.com/estree/estree/blob/master/spec.md#regexpliteral
  "message": {
    "regex": { "pattern": "^[^a-z\\s].*" },

    // …plus an optional human-readable description
    "description": "non-empty and sentence case (initial letter capitalized)"
  }
}

Another possibility is dropping the RegExp/variable expansion options in favor of pure RFC 5234 + RFC 7405 ABNF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions