Skip to content

fix(lint): reject invalid chart names#32075

Open
AkashKumar7902 wants to merge 2 commits intohelm:mainfrom
AkashKumar7902:issue-10537-chart-name-lint
Open

fix(lint): reject invalid chart names#32075
AkashKumar7902 wants to merge 2 commits intohelm:mainfrom
AkashKumar7902:issue-10537-chart-name-lint

Conversation

@AkashKumar7902
Copy link
Copy Markdown

@AkashKumar7902 AkashKumar7902 commented Apr 24, 2026

What this PR does / why we need it:

Closes #10537.

This updates chartfile lint validation so chart names must use lower case letters, numbers, and internal dashes. The new lint rule rejects names with uppercase letters, dots, underscores, or leading/trailing dashes and reports a clearer pattern message.

The same validation is used by chart creation, including starter-based chart creation, so helm create does not scaffold chart names that helm lint rejects. The same validation and table-driven coverage are applied to the v2 and v3 chart paths so both stay consistent.

Special notes for your reviewer:

Validation run locally:

  • go test -count=1 ./pkg/chart/v2/lint/... ./internal/chart/v3/lint/... ./pkg/chart/v2/util ./internal/chart/v3/util
  • go test ./pkg/action -run TestLint -count=1
  • go test -count=1 ./pkg/cmd -run TestCreate
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.3 run --allow-parallel-runners ./pkg/chart/v2/lint/rules ./internal/chart/v3/lint/rules ./pkg/chart/v2/util ./internal/chart/v3/util
  • scripts/validate-license.sh
  • git diff --check

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Copilot AI review requested due to automatic review settings April 24, 2026 21:57
@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Helm chartfile linting to reject invalid chart names and applies the same rule/tests to both the v2 and v3 chartfile lint rule sets.

Changes:

  • Add a stricter chart name validator (lowercase letters/digits with internal dashes; no leading/trailing dash).
  • Improve invalid-name lint output by appending a clearer constraint message.
  • Replace fixture-based tests with table-driven test cases for chart name validation (v2 and v3).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
pkg/chart/v2/lint/rules/chartfile.go Adds regex-based chart name validation and a clearer guidance message for lint failures.
pkg/chart/v2/lint/rules/chartfile_test.go Converts chart-name validation coverage to a table-driven test set.
internal/chart/v3/lint/rules/chartfile.go Mirrors the v2 regex-based chart name validation for the v3 lint path.
internal/chart/v3/lint/rules/chartfile_test.go Mirrors the v2 table-driven chart-name validation tests for the v3 lint path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/chart/v2/lint/rules/chartfile.go Outdated
Comment thread pkg/chart/v2/lint/rules/chartfile_test.go
Comment thread internal/chart/v3/lint/rules/chartfile.go Outdated
Comment thread internal/chart/v3/lint/rules/chartfile_test.go
@promptless-for-oss
Copy link
Copy Markdown

Promptless prepared a documentation update related to this change.

Triggered by this PR

Documents the stricter chart name validation requirements in the Chart Best Practices guide, clarifying that chart names must use only lowercase letters, numbers, and dashes, and must start and end with a lowercase letter or number. Updated both v3 and v4 documentation.

Review: Clarify chart name validation rules

Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm lint misses bad chart names

3 participants