question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `issuePrefixes` to be a RegEx

See original GitHub issue

Currently, I have to set a multitude of prefixes for all my projects, and it would be best if I could just allow a RegEx:

Actual: issuePrefixes: ['XCAF-', 'ELNEW-', 'CRES-'] Preferred: issuePrefixes: /[A-Z]+-/

Would be even better if we could just define what an issue is instead of just a prefix. That would allow for any system: /#(\d+)\b/, /\b([A-Z]+-\d+)\b/, /\b(\d+)\$/, etc (notice the capturing group as well so it captures exactly what an issue is)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alfaprojectcommented, Jan 24, 2018

Yes, I’ll give it a shot this weekend

0reactions
gerlvcommented, Oct 24, 2019

I’ve checked the issue prefix code, technically you can pass valid regex as a string and it will be converted into regex.

We are using JIRA for issues, the format is JIRA-123, but JIRA part is usually project-specific, i.e. PROJA or PROJB, so passing -i "[A-Z]+-" matches JIRA tickets.

But, it also matches J-I-R-A-1, doesn’t match J-I-R-A.

I.e. log.txt

fix: something

Closes JIRA-123

conventional-commits-parser -i "[A-Z]+-" log.txt will match JIRA-123:

$ conventional-commits-parser -i "[A-Z]+-" log.txt | jq .
[
  {
    "type": "fix",
    "scope": null,
    "subject": "something",
    "merge": null,
    "header": "fix: something",
    "body": null,
    "footer": "Closes JIRA-123",
    "notes": [],
    "references": [
      {
        "action": "Closes",
        "owner": null,
        "repository": null,
        "issue": "123",
        "raw": "JIRA-123",
        "prefix": "JIRA-"
      }
    ],
    "mentions": [],
    "revert": null
  }
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Regular expression for a JIRA identifier - Stack Overflow
I think, but can't verify, Jira truncates issue prefixes to 4 characters max. So the regex I did only allows 1-4 capital letters; ......
Read more >
Regular Expression (Regex) Tutorial
(Range Expression): Accept ANY ONE of the character in the range, e.g., [0-9] matches any digit; [A-Za-z] matches any uppercase or lowercase letters....
Read more >
An introduction to regular expressions - O'Reilly
The fullmatch() function will accept a regex pattern and an input string to test against. It will return a match object if a...
Read more >
Regular expressions - JavaScript - MDN Web Docs
Regular expressions are patterns used to match character combinations in strings. ... Regular expressions have optional flags that allow for ...
Read more >
Regular Expression Language - Quick Reference
This allows the regular expression engine to disambiguate language elements (such as * or ?) and character literals (represented by \* or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found