Merge pull request #31294 from TerryHowe/feature-remove-implicit-directory-from-helm-lint

Remove implicit support for helm lint current directory
main
Robert Sirchia 1 day ago committed by GitHub
commit 5b43b744b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -30,6 +30,7 @@ import (
"helm.sh/helm/v4/pkg/chart/common" "helm.sh/helm/v4/pkg/chart/common"
"helm.sh/helm/v4/pkg/chart/v2/lint/support" "helm.sh/helm/v4/pkg/chart/v2/lint/support"
"helm.sh/helm/v4/pkg/cli/values" "helm.sh/helm/v4/pkg/cli/values"
"helm.sh/helm/v4/pkg/cmd/require"
"helm.sh/helm/v4/pkg/getter" "helm.sh/helm/v4/pkg/getter"
) )
@ -51,11 +52,9 @@ func newLintCmd(out io.Writer) *cobra.Command {
Use: "lint PATH", Use: "lint PATH",
Short: "examine a chart for possible issues", Short: "examine a chart for possible issues",
Long: longLintHelp, Long: longLintHelp,
Args: require.MinimumNArgs(1),
RunE: func(_ *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
paths := []string{"."} paths := args
if len(args) > 0 {
paths = args
}
if kubeVersion != "" { if kubeVersion != "" {
parsedKubeVersion, err := common.ParseKubeVersion(kubeVersion) parsedKubeVersion, err := common.ParseKubeVersion(kubeVersion)

@ -91,6 +91,15 @@ func TestLintCmdWithKubeVersionFlag(t *testing.T) {
runTestCmd(t, tests) runTestCmd(t, tests)
} }
func TestLintCmdRequiresArgs(t *testing.T) {
tests := []cmdTestCase{{
name: "lint without arguments should fail",
cmd: "lint",
wantError: true,
}}
runTestCmd(t, tests)
}
func TestLintFileCompletion(t *testing.T) { func TestLintFileCompletion(t *testing.T) {
checkFileCompletion(t, "lint", true) checkFileCompletion(t, "lint", true)
checkFileCompletion(t, "lint mypath", true) // Multiple paths can be given checkFileCompletion(t, "lint mypath", true) // Multiple paths can be given

Loading…
Cancel
Save