Skip to content

Commit 6a9b96a

Browse files
Copilotpelikhan
andauthored
refactor: add doc comments to extracted helper functions
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent e93a8c1 commit 6a9b96a

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

pkg/console/console.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func RenderTable(config TableConfig) string {
236236
}
237237

238238
// buildTableStyleFunc returns the lipgloss style function used by RenderTable.
239+
// config supplies the ShowTotal/TotalRow flags; ttyCheck detects terminal output;
240+
// dataRowCount is the number of data rows (excluding any total row).
239241
func buildTableStyleFunc(config TableConfig, ttyCheck func() bool, dataRowCount int) func(int, int) lipgloss.Style {
240242
return func(row, col int) lipgloss.Style {
241243
if !ttyCheck() {

pkg/github/label_objective_mapping.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func (om *ObjectiveMapping) ComputeObjectiveValue(issueLabels []string) int {
7272
}
7373
}
7474

75+
// computeValueSum adds all matching label values and logs the result.
7576
func (om *ObjectiveMapping) computeValueSum(matchingValues []int, matchedLabels []string) int {
7677
total := 0
7778
for _, v := range matchingValues {
@@ -81,6 +82,9 @@ func (om *ObjectiveMapping) computeValueSum(matchingValues []int, matchedLabels
8182
return total
8283
}
8384

85+
// computeValueFirst returns the value for the highest-priority matching label.
86+
// It walks issueLabels in priority order; if none match, it falls back to the
87+
// first label in matchingValues.
8488
func (om *ObjectiveMapping) computeValueFirst(issueLabels []string, matchingValues []int, matchedLabels []string) int {
8589
// Return first issue label that's in priority_labels
8690
if len(om.PriorityLabels) > 0 {
@@ -102,6 +106,7 @@ func (om *ObjectiveMapping) computeValueFirst(issueLabels []string, matchingValu
102106
return result
103107
}
104108

109+
// computeValueMax returns the highest value among all matching labels.
105110
func (om *ObjectiveMapping) computeValueMax(matchingValues []int, matchedLabels []string) int {
106111
maxVal := matchingValues[0]
107112
for _, v := range matchingValues {

pkg/parser/schema_suggestions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ func findFieldLocationsInSchema(schemaDoc any, targetField, currentPath string)
661661
return fuzzyMatches
662662
}
663663

664+
// collectExactFieldMatches returns all locations in allLocations where the field
665+
// name case-insensitively equals targetField, excluding the currentPath location.
666+
// Duplicate (fieldName, schemaPath) pairs are suppressed.
664667
func collectExactFieldMatches(allLocations []schemaFieldLocation, targetField, currentPath string) []schemaFieldLocation {
665668
seen := make(map[string]struct{})
666669
var exactMatches []schemaFieldLocation
@@ -681,6 +684,9 @@ func collectExactFieldMatches(allLocations []schemaFieldLocation, targetField, c
681684
return exactMatches
682685
}
683686

687+
// collectFuzzyFieldMatches returns locations whose field names are within
688+
// maxPathSearchDistance Levenshtein edits of targetLower, excluding currentPath.
689+
// Results are sorted by distance ascending, then by schema path for stable output.
684690
func collectFuzzyFieldMatches(allLocations []schemaFieldLocation, targetLower, currentPath string) []schemaFieldLocation {
685691
seen := make(map[string]struct{})
686692
var fuzzyMatches []schemaFieldLocation

0 commit comments

Comments
 (0)