android-components
android-components copied to clipboard
Close #12623: Do not match issue ID if preceded by other characters
To avoid matching against issues in other repositories, we can reduce our matches to not include values if they are preceded by 1 or more string/number/hypen/underscore values.
Tested using:
- a JS console:
const issueRegExp = new RegExp("(?<![A-Za-z\\-\\_]+)#(\\d+)+", "g"); const numMatches = Array.from(issueRegExp[Symbol.matchAll]("mozilla-mobile/android-components#12345")).length const numMatches2 = Array.from(issueRegExp[Symbol.matchAll](" #12345 ")).length assert(numMatches == 0); assert(numMatches2 == 1); - regex tester: https://regexr.com/6rg2v
- We get this warning:
The "negative lookbehind" feature may not be supported in all browsers."
- From https://caniuse.com/js-regexp-lookbehind. Chrome has support support for this since version 67 which should be support by node16 that we use.
- We get this warning:
Pull Request checklist
- [x] Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
- [x] Tests: This PR includes thorough tests or an explanation of why it does not
- [x] Changelog: This PR includes a changelog entry or does not need one
- [x] Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features
After merge
- Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
- Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.
GitHub Automation
Fixes #12623
Case and point. 😄