Skip to content

Commit

Permalink
Merge pull request #28 from fredbi/ci-linting
Browse files Browse the repository at this point in the history
updated CI config
  • Loading branch information
fredbi authored Nov 23, 2020
2 parents 4803fe9 + 539a3d9 commit 1896884
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
21 changes: 21 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,24 @@ linters:
- maligned
- lll
- gochecknoglobals
- godox
- gocognit
- whitespace
- wsl
- funlen
- gochecknoglobals
- gochecknoinits
- scopelint
- wrapcheck
- exhaustivestruct
- exhaustive
- nlreturn
- testpackage
- gci
- gofumpt
- goerr113
- gomnd
- tparallel
- nestif
- godot
- errorlint
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
after_success:
- bash <(curl -s https://codecov.io/bash)
go:
- 1.13.x
- 1.14.x
- 1.x
arch:
- amd64
- ppc64le
jobs:
include:
# only run fast tests on ppc64le
- go: 1.x
arch: ppc64le
script:
- gotestsum -f short-verbose -- ./...

# include linting job, but only for latest go version and amd64 arch
- go: 1.x
arch: amd64
install:
go get github.com/golangci/golangci-lint/cmd/golangci-lint
script:
- golangci-lint run --new-from-rev master
install:
- GO111MODULE=off go get -u gotest.tools/gotestsum
language: go
Expand Down
22 changes: 11 additions & 11 deletions schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func TestSchemaErrors(t *testing.T) {
assert.EqualValues(t, CompositeErrorCode, err2.Code())
assert.Equal(t, "validation failure list:\nfirst error\nsecond error", err2.Error())

//func MultipleOfMustBePositive(name, in string, factor interface{}) *Validation {
// func MultipleOfMustBePositive(name, in string, factor interface{}) *Validation {
err = MultipleOfMustBePositive("path", "body", float64(-10))
assert.Error(t, err)
assert.EqualValues(t, MultipleOfMustBePositiveCode, err.Code())
Expand All @@ -368,52 +368,52 @@ func TestSchemaErrors(t *testing.T) {
err = PropertyNotAllowed("path", "body", "key")
assert.Error(t, err)
assert.EqualValues(t, UnallowedPropertyCode, err.Code())
//unallowedProperty = "%s.%s in %s is a forbidden property"
// unallowedProperty = "%s.%s in %s is a forbidden property"
assert.Equal(t, "path.key in body is a forbidden property", err.Error())

err = PropertyNotAllowed("path", "", "key")
assert.Error(t, err)
assert.EqualValues(t, UnallowedPropertyCode, err.Code())
//unallowedPropertyNoIn = "%s.%s is a forbidden property"
// unallowedPropertyNoIn = "%s.%s is a forbidden property"
assert.Equal(t, "path.key is a forbidden property", err.Error())

//func TooManyProperties(name, in string, n int64) *Validation {
// func TooManyProperties(name, in string, n int64) *Validation {
err = TooManyProperties("path", "body", 10)
assert.Error(t, err)
assert.EqualValues(t, TooManyPropertiesCode, err.Code())
//tooManyProperties = "%s in %s should have at most %d properties"
// tooManyProperties = "%s in %s should have at most %d properties"
assert.Equal(t, "path in body should have at most 10 properties", err.Error())

err = TooManyProperties("path", "", 10)
assert.Error(t, err)
assert.EqualValues(t, TooManyPropertiesCode, err.Code())
//tooManyPropertiesNoIn = "%s should have at most %d properties"
// tooManyPropertiesNoIn = "%s should have at most %d properties"
assert.Equal(t, "path should have at most 10 properties", err.Error())

err = TooFewProperties("path", "body", 10)
// func TooFewProperties(name, in string, n int64) *Validation {
assert.Error(t, err)
assert.EqualValues(t, TooFewPropertiesCode, err.Code())
//tooFewProperties = "%s in %s should have at least %d properties"
// tooFewProperties = "%s in %s should have at least %d properties"
assert.Equal(t, "path in body should have at least 10 properties", err.Error())

err = TooFewProperties("path", "", 10)
// func TooFewProperties(name, in string, n int64) *Validation {
assert.Error(t, err)
assert.EqualValues(t, TooFewPropertiesCode, err.Code())
//tooFewPropertiesNoIn = "%s should have at least %d properties"
// tooFewPropertiesNoIn = "%s should have at least %d properties"
assert.Equal(t, "path should have at least 10 properties", err.Error())

//func FailedAllPatternProperties(name, in, key string) *Validation {
// func FailedAllPatternProperties(name, in, key string) *Validation {
err = FailedAllPatternProperties("path", "body", "key")
assert.Error(t, err)
assert.EqualValues(t, FailedAllPatternPropsCode, err.Code())
//failedAllPatternProps = "%s.%s in %s failed all pattern properties"
// failedAllPatternProps = "%s.%s in %s failed all pattern properties"
assert.Equal(t, "path.key in body failed all pattern properties", err.Error())

err = FailedAllPatternProperties("path", "", "key")
assert.Error(t, err)
assert.EqualValues(t, FailedAllPatternPropsCode, err.Code())
//failedAllPatternPropsNoIn = "%s.%s failed all pattern properties"
// failedAllPatternPropsNoIn = "%s.%s failed all pattern properties"
assert.Equal(t, "path.key failed all pattern properties", err.Error())
}

0 comments on commit 1896884

Please sign in to comment.