linear-b / gitstream

/:\ gitStream - Workflow automation for your git repo. Use YAML to auto-assign reviewers, auto-merge PRs, automatic PR labeler, and more.
https://gitstream.cm
Apache License 2.0
247 stars 29 forks source link

Fix todo example #543

Closed Yusyuriv closed 2 weeks ago

Yusyuriv commented 3 weeks ago

I encountered an issue in a project I'm contributing to: gitStream would request changes saying my PR has a todo in it, even though I didn't add any todos. I asked another team member if they know what the issue is, and they figured it out: our todo regex was copied from the example in the docs, and that example is incorrect. The current example:

/^[+].*(TODO)|(todo)/

It matches:

  1. either a line starting with a plus sign, followed by any amount of any characters, followed by TODO (uppercase)
  2. or it matches any line that has todo (lowercase) in it, ignoring the ^[+].* part

Because of the second part, it reacted to a todo comment I had deleted. This PR fixes this issue by placing both variants (TODO and todo) inside the same group.

Demo on regex101: before the change, after the change

jit-ci[bot] commented 3 weeks ago

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

BenLloydPearson commented 3 weeks ago

Thanks for the fix @Yusyuriv This is super helpful!

vim-zz commented 2 weeks ago

Thank you Yan!