sourcegraph/sourcegraph-public-snapshot

insights: refactor capture group methods for readability and performance

Open

#33,148 opened on Mar 28, 2022

 (11 comments) (0 reactions) (0 assignees)Go (1,374 forks)auto 404
backendcode-insightsgood first issue

Repository metrics

Stars
 (10,290 stars)
PR merge metrics
 (PR metrics pending)

Description

When a capture group insight is created, we tally up matches per capture group using MatchValues and Counts methods on ComputeMatchContext. We then group them in the method GroupByCaptureMatch.

The current logic uses many nested for loops. The aim of this ticket is to look into simplifying this logic. What we want at the end is a map of unique capture group values to their count.

Contributor guide