Skip to content

Commit

Permalink
Merge pull request #87 from tzifudzi/fix-broken-ci
Browse files Browse the repository at this point in the history
Resolve lint errors causing CI to break
  • Loading branch information
knabben authored Aug 13, 2023
2 parents 4cb47d6 + 5f57a96 commit 5075a31
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
8 changes: 2 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ linters:
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
- exportloopref
Expand All @@ -19,7 +17,6 @@ linters:
- gosec
- gosimple
- govet
- ifshort
- importas
- ineffassign
- misspell
Expand All @@ -32,16 +29,15 @@ linters:
- revive
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- thelper
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

disable:
- depguard # Disabling because it is causing CI to break. See issue https://github.com/golangci/golangci-lint/issues/3906 fore more
run:
skip-files:
- "kubernetes/.*"
Expand Down
1 change: 0 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"k8s.io/client-go/tools/clientcmd"

"sigs.k8s.io/windows-operational-readiness/pkg/flags"
"sigs.k8s.io/windows-operational-readiness/pkg/testcases"
)
Expand Down
7 changes: 2 additions & 5 deletions pkg/testcases/cases.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"strconv"

"go.uber.org/zap"

"sigs.k8s.io/windows-operational-readiness/pkg/report"
)

Expand Down Expand Up @@ -167,10 +166,8 @@ func CleanupJUnitXML(path string) error {
if cleanContent, err = xml.MarshalIndent(testSuites, " ", " "); err != nil {
return err
}
if err = writeFileContent(path, cleanContent); err != nil {
return err
}
return nil

return writeFileContent(path, cleanContent)
}

// writeFileContent save the content to a file.
Expand Down
3 changes: 1 addition & 2 deletions pkg/testcases/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"go.uber.org/zap"
"gopkg.in/yaml.v3"

"sigs.k8s.io/windows-operational-readiness/pkg/flags"
)

Expand Down Expand Up @@ -101,7 +100,7 @@ func getTestFiles(testDirectory string) ([]string, error) {
return nil, err
}

testDirectory = testDirectory + "/specifications/"
testDirectory += "/specifications/"
}

testFiles := make([]string, 0)
Expand Down
9 changes: 2 additions & 7 deletions pkg/testcases/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package testcases

import (
"fmt"

"github.com/go-playground/validator/v10"
"go.uber.org/zap"
)
Expand All @@ -27,17 +25,14 @@ import (
func (s *Specification) validateYAML() error {
validate := validator.New()
validate.RegisterStructValidation(SpecificationValidation, Specification{})
if err := validate.Struct(s); err != nil {
return err
}
return nil
return validate.Struct(s)
}

// SpecificationValidation set the required fields and is used by the validator function.
func SpecificationValidation(sl validator.StructLevel) {
specification := sl.Current().Interface().(Specification)
if specification.Category == "" {
zap.L().Error(fmt.Sprintf("Category Required"))
zap.L().Error("Category Required")
sl.ReportError(specification.Category, "category", "Category", "categoryRequired", "")
}
for _, testCase := range specification.TestCases {
Expand Down

0 comments on commit 5075a31

Please sign in to comment.