andygrunwald / jitic

The JIRA Ticket Checker - Checks the existence of one or more ticket in the JIRA issue tracker
MIT License
33 stars 4 forks source link

False negatives for messages with strings resembling Jira issues #8

Open M3t0r opened 6 years ago

M3t0r commented 6 years ago

Given a commit message like "ABC-123 fix missing xyz-987654321" and two projects named ABC and XYZ, jitic will find both ABC-123 and xyz-987654321 to be issues and check for their existence. Because xyz-987654321 refers to something unrelated (in our case a database ID) and has a bigger number than there are tickets in the XYZ project the check fails and the commit is rejected by our git server.

I think something like a --first or --only-first flag might be a good solution to this problem. Most of our commit messages reference the ticket as the first thing. [ABC-123] fixing bug or ABC-456 implementing changes are a common pattern. Even something like Implementing ABC-789 to fix issues related to xyz-192837465 will still work with that.

This is partially related to #4.

M3t0r commented 6 years ago

I just had a chat with @andygrunwald and we settled on implementing something like a --check-one-exists flag which will only error out if none of the found issues exist in Jira but as soon as it finds one it will os.Exit(0).

I'll implement this some time this week.