Skip to content

Invalid regex in commitConfig causes pushes to crash/error out #1336

@jescalada

Description

@jescalada

When setting invalid regex for the patterns in commitConfig, pushes either fail (in the case of commitConfig.author.email.local.block) or give a misleading error (in the case of commitConfig.message.block.patterns.

Invalid author config:

"author": {
  "email": {
    "local": {
      "block": "[invalid"
    },
    "domain": {
      "allow": "(?<invalid"
    }
  }
},

Output:

Image

Invalid message config:

"message": {
  "block": {
    "literals": ["safe"],
    "patterns": [
      "[unclosed",
      "(?<incomplete",
      "*invalid",
      "(?P<invalid>",
      "\\k<notdefined>"
    ]
  }
},

Output:

Image

Invalid diff config:

"diff": {
  "block": {
    "literals": [],
    "patterns": [
      "[unclosed",
      "(?<incomplete"
    ],
    "providers": {
      "Bad Provider": "*starts-with-quantifier",
      "Unclosed Group": "(forgot to close"
    }
  }
}

Output:

Image

Describe the solution you'd like
These are likely fixed by improving the error handling in the checkCommitMessages.ts, checkAuthorEmails.ts and scanDiff.ts processors. We should make sure each action gives a descriptive error on invalid regex but blocks the push instead of crashing.

Additional context
Found when writing documentation for the chain in #1335

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions