Repository: helm/helm (Go)

Issue:
Using `helm lint <path> --quiet` produces no output, even when there's an error.
### What happened?

When running `helm lint <path> --quiet`, for some reason, `helm doesn't show any errors. However, if `--quiet` is removed, then errors are shown.

### Steps to reproduce

1. run `helm lint nonexistent/ --quiet`
2. No error is displayed despite that `nonexistent/` doesn't exist. The command exit code is `0` and not `1` to indicate an error.
3. run `helm lint nonexistent/`
4. the output is
```
==> Linting nonexistent/
Error unable to check Chart.yaml file in chart: stat nonexistent/Chart.yaml: no such file or directory

Error: 1 chart(s) linted, 1 chart(s) failed
```

1. run `mkdir charts/`
2. run `helm lint charts/ --quiet`
3. no error is displayed despite the missing `Chart.yaml`. The command exit code is `0` and not `1` to indicate an error.
4. run `helm lint charts/`
```
==> Linting charts/
Error unable to check Chart.yaml file in chart: stat charts/Chart.yaml: no such file or directory

Error: 1 chart(s) linted, 1 chart(s) failed
```

### Expected Behavior

As stated in the command usage `--quiet print only warnings and errors` which is not honored in this case. On error, the command should return `1`.

### Actual Behavior

No outputs at all, including errors. Even with a clear error, the command exit code is `0`.

### Additional context

Output of `helm version`: `version.BuildInfo{Version:"v3.10.0", GitCommit:"ce66412a723e4d89555dc67217607c6579ffcb21", GitTreeState:"clean", GoVersion:"go1.18.6"}`

Output of `kubectl version`: `Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.2", GitCommit:"5835544ca568b757a8ecae5c153f317e5736700e", GitTreeState:"clean", BuildDate:"2022-09-21T14:33:49Z", GoVersion:"go1.19.1", Compiler:"gc", Platform:"linux/amd64"}`

Cloud Provider/Platform (AKS, GKE, Minikube etc.): `k3s` and bare-metal

### Contributing

Vote on this issue by adding a 👍 reaction. 
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already). 



Discussion:
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
@joejulian Is there anyone that should look into this please?
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.



Patch:
diff --git a/pkg/action/lint.go b/pkg/action/lint.go
index adb8ebcab5b..e71cfe73312 100644
--- a/pkg/action/lint.go
+++ b/pkg/action/lint.go
@@ -82,7 +82,7 @@ func HasWarningsOrErrors(result *LintResult) bool {
 			return true
 		}
 	}
-	return false
+	return len(result.Errors) > 0
 }
 
 func lintChart(path string, vals map[string]interface{}, namespace string, strict bool) (support.Linter, error) {


Test patch:
diff --git a/cmd/helm/lint_test.go b/cmd/helm/lint_test.go
index ebea09bf030..314b54c353d 100644
--- a/cmd/helm/lint_test.go
+++ b/cmd/helm/lint_test.go
@@ -53,6 +53,11 @@ func TestLintCmdWithQuietFlag(t *testing.T) {
 		name:   "lint chart with warning using --quiet flag",
 		cmd:    "lint --quiet testdata/testcharts/chart-with-only-crds",
 		golden: "output/lint-quiet-with-warning.txt",
+	}, {
+		name:      "lint non-existent chart using --quiet flag",
+		cmd:       "lint --quiet thischartdoesntexist/",
+		golden:    "",
+		wantError: true,
 	}}
 	runTestCmd(t, tests)