Skip to content

Commit 84eb04f

Browse files
committed
Add some comments about parsing of key comments
1 parent d1a32aa commit 84eb04f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/helm/chart_info.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,13 @@ func parseChartValuesFileComments(chartDirectory string, values *yaml.Node, lint
267267
continue
268268
}
269269

270-
// If we've already found a values comment, on the next line try and parse a custom default value. If we find one
271-
// that completes parsing for this key, add it to the list and reset to searching for a new key
270+
// If we've already found a values comment, on the next line try and parse a comment continuation, a custom default value, or a section comment.
271+
// If we find continuations we can add them to the list and continue to the next line until we find a section comment or default value.
272+
// If we find a default value, we can add it to the list and continue to the next line. In the case we don't find one, we continue looking for a section comment.
273+
// When we eventually find a section comment, we add it to the list and conclude matching for the current key. If we don't find one, matching is also concluded.
274+
//
275+
// NOTE: This isn't readily enforced yet, because we can match the section comment and custom default value more than once and in another order, although this is just overwriting it.
276+
// Values comment, possible continuation, default value once or none then section comment once or none should be the preferred order.
272277
defaultCommentMatch := defaultValueRegex.FindStringSubmatch(currentLine)
273278
sectionCommentMatch := sectionRegex.FindStringSubmatch(currentLine)
274279
commentContinuationMatch := commentContinuationRegex.FindStringSubmatch(currentLine)

0 commit comments

Comments
 (0)