Suggestions should not overlap each other
We created an example of a useless pattern named Gumfile that should suggest Gemfile but the Gemfile is already in place in the code owners file. In this case, it should suggest to add one more owner instead of adding a new line to the owners' file. Or suggest to delete the line, or ignore the suggestion.
We're not sure about the best approach, we need to research and see what fits better for our flow.
Analyzing the issue we brought the following points:
If we suggest something that is already in the code owners we're going to duplicate the ownership lines. If we find multiple patterns matching the same file, and the pattern is generic, covering a folder, it's ok.
But, if the pattern is only covering one file and it's duplicated in the code owners definition we could merge the owners and make it a single line.
We're confused with the direction of the implementation:
- Focus on what is duplicated can lead us to fix the issue but will not avoid suggesting duplicates
- Process all files against all patterns will be expensive to process
- If we remove all suggestions, maybe it will not bring a good suggestion and we'll need to upgrade our fuzzy match search.