Skip to content

Commit

Permalink
fix(schema): also remove helm-docs tags when not running with dontRem…
Browse files Browse the repository at this point in the history
…oveHelmDocsPrefix

Comments containing special _helm-docs_ metadata (_tags_) previously
became part of the value description;
this commit removes those lines starting with `@something`,
and optionally continuing with ` -- something else`

fixes #45
  • Loading branch information
Markus Möslinger committed Aug 31, 2024
1 parent 4e067df commit ebebdc6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ func YamlToSchema(
log.Fatalf("Error while parsing comment of key %s: %v", keyNode.Value, err)
}
if !dontRemoveHelmDocsPrefix {
// remove all lines containing helm-docs @tags, like @ignored, or one of those:
// https://github.com/norwoodj/helm-docs/blob/v1.14.2/pkg/helm/chart_info.go#L18-L24
helmDocsTagsRemover := regexp.MustCompile(`(?ms)(\r\n|\r|\n)?\s*@\w+(\s+--\s)?[^\n\r]*`)
description = helmDocsTagsRemover.ReplaceAllString(description, "")

prefixRemover := regexp.MustCompile(`(?m)^--\s?`)
description = prefixRemover.ReplaceAllString(description, "")
}
Expand Down

0 comments on commit ebebdc6

Please sign in to comment.