alstr / todo-to-issue-action

Action that converts TODO comments to GitHub issues on push.
MIT License
633 stars 121 forks source link

false issue created if comment matches identifier in a substring #234

Open rgalonso opened 2 weeks ago

rgalonso commented 2 weeks ago

The identifier matching is not done using word breaks. Rather, it looks for either a whitespace character or a colon to follow the identifier. i.e. TODO issue_title and TODO: issue_title will both match, but TODO at the end of the line will not. However, this doesn't consider the possibility that non-whitespace characters precede the identifier. In other words, this means that due to this pattern match and case-insensitivity, using FIX as an identifier leads to the following comment being matched

  suffixed_str = base + suffix # add the suffix after the base string

The fix of suffix is seen as an identifier and after the base string is considered the issue title.

Word breaks should be used for pattern matching the identifier. i.e. \b{identifier}\b

alstr commented 2 weeks ago

I think this stems from the earliest version of the action, which didn't support other identifiers, where I must have been like "nothing can ever feature the word todo in". 😆

rgalonso commented 2 weeks ago

Haha, yeah, I would've thought so too. Imagine my surprise when it actually happened to me: "autodocumentation". I wouldn't consider that one word, but evidently someone does because there it is in my project!

alstr commented 2 weeks ago

Yeah, I'm sure there are cases, word boundaries are definitely the way to go.