fix: add new static linter and fix issues it found

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
pull/7655/head
Matt Butcher 6 years ago
parent 7f3339cb4e
commit 6afd0b4c6c
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -17,6 +17,7 @@ linters:
- structcheck - structcheck
- unused - unused
- varcheck - varcheck
- staticcheck
linters-settings: linters-settings:
gofmt: gofmt:

@ -29,6 +29,7 @@ require (
github.com/stretchr/testify v1.4.0 github.com/stretchr/testify v1.4.0
github.com/xeipuuv/gojsonschema v1.1.0 github.com/xeipuuv/gojsonschema v1.1.0
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
k8s.io/api v0.17.3 k8s.io/api v0.17.3
k8s.io/apiextensions-apiserver v0.17.3 k8s.io/apiextensions-apiserver v0.17.3
k8s.io/apimachinery v0.17.3 k8s.io/apimachinery v0.17.3

@ -162,13 +162,13 @@ func (suite *RegistryClientTestSuite) Test_2_LoadChart() {
// non-existent ref // non-existent ref
ref, err := ParseReference(fmt.Sprintf("%s/testrepo/whodis:9.9.9", suite.DockerRegistryHost)) ref, err := ParseReference(fmt.Sprintf("%s/testrepo/whodis:9.9.9", suite.DockerRegistryHost))
suite.Nil(err) suite.Nil(err)
ch, err := suite.RegistryClient.LoadChart(ref) _, err = suite.RegistryClient.LoadChart(ref)
suite.NotNil(err) suite.NotNil(err)
// existing ref // existing ref
ref, err = ParseReference(fmt.Sprintf("%s/testrepo/testchart:1.2.3", suite.DockerRegistryHost)) ref, err = ParseReference(fmt.Sprintf("%s/testrepo/testchart:1.2.3", suite.DockerRegistryHost))
suite.Nil(err) suite.Nil(err)
ch, err = suite.RegistryClient.LoadChart(ref) ch, err := suite.RegistryClient.LoadChart(ref)
suite.Nil(err) suite.Nil(err)
suite.Equal("testchart", ch.Metadata.Name) suite.Equal("testchart", ch.Metadata.Name)
suite.Equal("1.2.3", ch.Metadata.Version) suite.Equal("1.2.3", ch.Metadata.Version)

@ -116,11 +116,9 @@ func Templates(linter *support.Linter, values map[string]interface{}, namespace
// key will be raised as well // key will be raised as well
err := yaml.Unmarshal([]byte(renderedContent), &yamlStruct) err := yaml.Unmarshal([]byte(renderedContent), &yamlStruct)
validYaml := linter.RunLinterRule(support.ErrorSev, path, validateYamlContent(err)) // If YAML linting fails, we sill progress. So we don't capture the returned state
// on this linter run.
if !validYaml { linter.RunLinterRule(support.ErrorSev, path, validateYamlContent(err))
continue
}
} }
} }

Loading…
Cancel
Save