Skip to content

Conversation

@cheap-glitch
Copy link
Contributor

@cheap-glitch cheap-glitch commented Dec 17, 2020

Thanks for contributing! 🍄

  1. LINKED ISSUES: Closes Add more keywords to hide-useless-comments #3822

  2. TEST URLS:

This PR:

  • removes spaces and basic punctuation from the comments before testing them — it makes it easier to match small sentences like "Please update, thanks" and all their possible variations
  • adds several keywords and their variations
  • adds support for skin tone modifiers on hand-related emojis (it's relatively rare but I've seen them used a few times)

TODO:

  • Rewrite using text.replace()
  • Add tests

@fregante
Copy link
Member

fregante commented Dec 17, 2020

Thanks! It’s worth adding a comment about the skin modifiers.

Also what do you think about:

if (text.replace(everykeyword, '').trim() === '') {
  return
}

This should cover repetition without complicating the regex, and also avoid multiple regexes.

It’d be also great to add some tests for this function

@cheap-glitch cheap-glitch marked this pull request as draft December 17, 2020 19:28
@cheap-glitch
Copy link
Contributor Author

@fregante: Building on your idea, how about:

if (text.replace(everykeyword, '').trim().length < 20) {
  return
}

This would catch a lot of small variations (e.g. justinfrankel/licecap#97 (comment), justinfrankel/licecap#97 (comment)) very easily. Ofc 20 is just off the top of my head, it should probably be adjusted.

@fregante
Copy link
Member

It's best to leave some comments visible than risk hiding useful comments; the comment needs to be a "perfect match" for us to be sure that it can be hidden. For this reason I'd adjust the regex to only specifically hide me too and not just me

@cheap-glitch cheap-glitch marked this pull request as ready for review December 19, 2020 14:46
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

cheap-glitch and others added 2 commits December 19, 2020 20:04
Co-authored-by: Federico <me@fregante.com>
@yakov116
Copy link
Member

@cheap-glitch keep up your great work. Wanted to give you a shout out on your super clear first posts!

@cheap-glitch cheap-glitch deleted the add-keywords-hide-useless-comments branch December 24, 2020 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Add more keywords to hide-useless-comments

3 participants