-
Notifications
You must be signed in to change notification settings - Fork 30
Prevent spam from GitHub mentions in merge commits #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5ac0d1f
to
4bcfb25
Compare
Hi, thanks for the PR, I'll try to take a look in the upcoming days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! The implementation looks like a good start, but there are a few things that should be modified, I left a bunch of comments.
Thanks for the feedback. I didn't put unicode text into consideration 😞. Will resolve shortly. |
Would fuzz test be ideal or overkill ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fuzz testing would be way overkill I think :) To clarify, I didn't mean that the GitHub username could include Unicode, as far as I know, it cannot contain it. So for matching the usernames, doing what you had before (a-zA-Z0-9
) was fine. Just the way you searched for the character before/after the match wasn't correct.
The code is now more complicated than before. What I meant was to solve the preceding/following word in the regex itself.
What do you think about this regex? (^|\s)@([a-zA-Z0-9][a-zA-Z0-9]*)($|\s)
Not sure this regex parse error:
(?<!\S)@[a-zA-Z0-9][a-zA-Z0-9\-]{0,38}(?:/[a-zA-Z0-9][a-zA-Z0-9\-]{0,38})*(?!\S)
^^^^
error: look-around, including look-ahead and look-behind, is not supported
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
) A workaround for look-around can be may be using the |
I know that |
Ofc we don't need look-around. |
Nice, this made the code much shorter and easier to understand! :) I think that we should use |
I'll add test for this using |
Yes, that was the idea :D I wonder if GitHub does indeed ping in these situations. It doesn't seem like so? I think that whitespace should be enough. Hello,@xosrndev, are you pinged? |
Hello, @xosrndev, are you pinged? Hmm, it doesn't ping even above, unless I manually select the user. I guess that it shouldn't be tested in PR/issue comments, but rather in the commit messages directly. We should first test on some test repo in which exact situations does GitHub indeed ping when the mention is in the commit message. |
Interesting, thanks for testing that out! Ok, in that case let's just use what homu does for now, which is |
bet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Copying homu is usually not a bad default, we can always make it smarter in the future. Left one last nit, otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Resolves #258