Skip to content

Commit

Permalink
fix: introduce better linting pipeline and resolve Go issues (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Apr 16, 2020
1 parent f5a0e96 commit e02f731
Show file tree
Hide file tree
Showing 12 changed files with 745 additions and 72 deletions.
17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
linters:
enable:
- gosec
disable:
- ineffassign
- deadcode
- unused
- structcheck
- errcheck
- gosimple
- bodyclose
- staticcheck

run:
skip-files:
- ".+_test.go"
- ".+_test_.+.go"
19 changes: 6 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,14 @@ language: go
go_import_path: github.com/ory/fosite

go:
- 1.11.x

env:
- GO111MODULE=on
- "1.14"

install:
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/pierrre/gotestcover github.com/bradfitz/goimports
- go install github.com/mattn/goveralls
- go install github.com/ory/go-acc
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0

script:
- curl -L https://git.io/vp6lP | sh
- mv ./bin/* $GOPATH/bin
- gometalinter --disable-all --enable=gofmt --enable=vet --vendor ./...
- touch ./coverage.tmp
- |
echo 'mode: atomic' > coverage.txt
- |
go list ./... | grep -v /vendor | grep -v /internal | xargs -n1 -I{} sh -c 'go test -race -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | grep -v /internal | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp
- golangci-lint run
- go-acc -o coverage.txt ./... -- -failfast -timeout=20m
- goveralls -coverprofile="coverage.txt"
56 changes: 28 additions & 28 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,34 +214,34 @@ var (
)

const (
errInvalidRequestURI = "invalid_request_uri"
errInvalidRequestObject = "invalid_request_object"
errConsentRequired = "consent_required"
errInteractionRequired = "interaction_required"
errLoginRequired = "login_required"
errRequestUnauthorizedName = "request_unauthorized"
errRequestForbidden = "request_forbidden"
errInvalidRequestName = "invalid_request"
errUnauthorizedClientName = "unauthorized_client"
errAccessDeniedName = "access_denied"
errUnsupportedResponseTypeName = "unsupported_response_type"
errInvalidScopeName = "invalid_scope"
errServerErrorName = "server_error"
errTemporarilyUnavailableName = "temporarily_unavailable"
errUnsupportedGrantTypeName = "unsupported_grant_type"
errInvalidGrantName = "invalid_grant"
errInvalidClientName = "invalid_client"
errNotFoundName = "not_found"
errInvalidStateName = "invalid_state"
errMisconfigurationName = "misconfiguration"
errInsufficientEntropyName = "insufficient_entropy"
errInvalidTokenFormatName = "invalid_token"
errTokenSignatureMismatchName = "token_signature_mismatch"
errTokenExpiredName = "token_expired"
errScopeNotGrantedName = "scope_not_granted"
errTokenClaimName = "token_claim"
errTokenInactiveName = "token_inactive"
errAuthorizaionCodeInactiveName = "authorization_code_inactive"
errInvalidRequestURI = "invalid_request_uri"
errInvalidRequestObject = "invalid_request_object"
errConsentRequired = "consent_required"
errInteractionRequired = "interaction_required"
errLoginRequired = "login_required"
errRequestUnauthorizedName = "request_unauthorized"
errRequestForbidden = "request_forbidden"
errInvalidRequestName = "invalid_request"
errUnauthorizedClientName = "unauthorized_client"
errAccessDeniedName = "access_denied"
errUnsupportedResponseTypeName = "unsupported_response_type"
errInvalidScopeName = "invalid_scope"
errServerErrorName = "server_error"
errTemporarilyUnavailableName = "temporarily_unavailable"
errUnsupportedGrantTypeName = "unsupported_grant_type"
errInvalidGrantName = "invalid_grant"
errInvalidClientName = "invalid_client"
errNotFoundName = "not_found"
errInvalidStateName = "invalid_state"
errMisconfigurationName = "misconfiguration"
errInsufficientEntropyName = "insufficient_entropy"
errInvalidTokenFormatName = "invalid_token"
errTokenSignatureMismatchName = "token_signature_mismatch"
errTokenExpiredName = "token_expired"
errScopeNotGrantedName = "scope_not_granted"
errTokenClaimName = "token_claim"
errTokenInactiveName = "token_inactive"
// errAuthorizaionCodeInactiveName = "authorization_code_inactive"
errUnknownErrorName = "error"
errRevokationClientMismatchName = "revokation_client_mismatch"
errRequestNotSupportedName = "request_not_supported"
Expand Down
31 changes: 13 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@ module github.com/ory/fosite

require (
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/elazarl/goproxy v0.0.0-20181003060214-f58a169a71a5 // indirect
github.com/golang/mock v1.4.3
github.com/gopherjs/gopherjs v0.0.0-20181004151105-1babbf986f6f // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v1.6.2
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/magiconair/properties v1.8.0
github.com/golang/protobuf v1.4.0 // indirect

This comment has been minimized.

Copy link
@lukaszgadomski

lukaszgadomski May 8, 2020

plz remove this, it is not used by this library

github.com/gorilla/mux v1.7.0
github.com/magiconair/properties v1.8.1
github.com/mattn/goveralls v0.0.5
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/moul/http2curl v0.0.0-20170919181001-9ac6cf4d929b // indirect
github.com/oleiade/reflections v1.0.0
github.com/ory/go-acc v0.2.1
github.com/ory/go-convenience v0.1.0
github.com/parnurzeal/gorequest v0.2.15
github.com/pborman/uuid v1.2.0
github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
github.com/stretchr/testify v1.2.2
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/oauth2 v0.0.0-20181003184128-c57b0facaced
google.golang.org/appengine v1.2.0 // indirect
gopkg.in/square/go-jose.v2 v2.1.9
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/square/go-jose.v2 v2.5.0
)

go 1.13
go 1.14
Loading

0 comments on commit e02f731

Please sign in to comment.