Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Update 2020 #65

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ checks-out.sqlite
.vscode
report.out
report.xml
*.iml
coverage.html
coverage.out
33 changes: 10 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ endif
# Propagate git revision number to version identifier
VERSION:=${VERSION_TAG}+$(shell git rev-parse --short HEAD)

# directories and remove vendor directory
# used for running unit tests
NOVENDOR := $(shell go list -e ./... | grep -v /vendor/)

# files and remove vendor directory, auto generated files, and mock files
# used for static analysis, code linting, and code formatting
NOVENDOR_FILES := $(shell find . -name "*.go" | grep -v /vendor/ | grep -v /mock/ | grep -v "_gen\.go" )

all: build

gen: gen-assets gen-migration
Expand All @@ -25,22 +17,22 @@ gen-assets:
gen-migration:
go generate github.com/capitalone/checks-out/store/migration

build:
build: test
@# static linking sqlite seems to break DNS
go build --ldflags '-X github.com/capitalone/checks-out/version.Version=$(VERSION)' -o checks-out
go test -run ^$$ $(NOVENDOR) > /dev/null

test: vet
@# use redirect instead of tee to preserve exit code
go test -short -p=1 -cover $(NOVENDOR) -v > report.out; \
go test -short -cover -v ./... > report.out; \
code=$$?; \
cat report.out; \
grep -e 'FAIL' report.out; \
exit $${code}
.PHONY: test

test-complete: vet
@# use redirect instead of tee to preserve exit code
GITHUB_TEST_ENABLE=1 go test -short -p=1 -cover $(NOVENDOR) -v > report.out; \
GITHUB_TEST_ENABLE=1 go test -short -cover -v ./... > report.out; \
code=$$?; \
cat report.out; \
grep -e 'FAIL' report.out; \
Expand All @@ -49,24 +41,19 @@ test-complete: vet
.PHONY: test-cover-html

test-cover-html:
echo "mode: count" > coverage-all.out
echo "Packages: $(NOVENDOR)"
echo "VERSION: $(VERSION)"
$(foreach pkg,$(NOVENDOR), \
echo ${pkg}; \
go test -coverprofile=coverage.out -covermode=count ${pkg}; \
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out -o coverage.html
@echo "VERSION: $(VERSION)"
go test -coverprofile=coverage.out -covermode=count ./...
go tool cover -html=coverage.out -o coverage.html

fmt:
for FILE in $(NOVENDOR_FILES); do go fmt $$FILE; done;
go fmt ./...

vet: get-modules
@echo 'Running go tool vet -shadow'
@for FILE in $(NOVENDOR_FILES); do go tool vet -shadow $$FILE || exit 1; done;
go vet ./...

lint: get-modules
for FILE in $(NOVENDOR_FILES); do golint $$FILE; done;
golint ./...

clean:
rm -f checks-out report.out
Expand Down
2 changes: 1 addition & 1 deletion admin/browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"context"
"fmt"

jsonpointer "github.com/mattn/go-jsonpointer"
"github.com/capitalone/checks-out/envvars"
"github.com/capitalone/checks-out/hjson"
"github.com/capitalone/checks-out/model"
"github.com/capitalone/checks-out/remote"
jsonpointer "github.com/mattn/go-jsonpointer"
)

var configFileName = fmt.Sprintf(".%s", envvars.Env.Branding.Name)
Expand Down
4 changes: 2 additions & 2 deletions api/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (
"github.com/capitalone/checks-out/shared/httputil"
"github.com/capitalone/checks-out/store"

"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)

func unauthorizedError() error {
Expand Down Expand Up @@ -126,7 +126,7 @@ func AdminDeleteRepo(c *gin.Context) {
httputil.GetURL(c.Request),
)

user, err := store.GetUser(c, repo.UserID)
user, err := store.GetUser(c, repo.UserID)
if err != nil {
msg := fmt.Sprintf("Deleting repository %s", name)
c.Error(exterror.Append(err, msg))
Expand Down
2 changes: 1 addition & 1 deletion api/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"bytes"
"encoding/json"

log "github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)

func IndentedJSON(c *gin.Context, code int, obj interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion api/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"github.com/capitalone/checks-out/shared/token"
"github.com/capitalone/checks-out/store"

"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

func collectAllOrgs(c *gin.Context) ([]*model.GitHubOrg, set.Set, error) {
Expand Down
2 changes: 1 addition & 1 deletion api/orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import (
"github.com/capitalone/checks-out/router/middleware"
"github.com/capitalone/checks-out/store"

"github.com/Sirupsen/logrus"
"github.com/franela/goblin"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

type mockCache struct {
Expand Down
2 changes: 1 addition & 1 deletion api/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"github.com/capitalone/checks-out/shared/token"
"github.com/capitalone/checks-out/store"

"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

// GetAllReposCount gets the count of all repositories managed by Checks-Out.
Expand Down
10 changes: 5 additions & 5 deletions api/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ See the License for the specific language governing permissions and limitations
package api

import (
"github.com/gin-gonic/gin"
"github.com/capitalone/checks-out/store"
"github.com/capitalone/checks-out/exterror"
"fmt"
"encoding/json"
"io/ioutil"
"fmt"
"github.com/capitalone/checks-out/exterror"
"github.com/capitalone/checks-out/router/middleware/session"
"github.com/capitalone/checks-out/store"
"github.com/gin-gonic/gin"
"io/ioutil"
)

type UrlHolder struct {
Expand Down
2 changes: 1 addition & 1 deletion api/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (

"github.com/capitalone/checks-out/model"

"github.com/Sirupsen/logrus"
"github.com/franela/goblin"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)

func TestUsers(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"context"
"time"

"github.com/koding/cache"
"github.com/capitalone/checks-out/envvars"
"github.com/koding/cache"
)

type Cache interface {
Expand Down
2 changes: 1 addition & 1 deletion cmd/integration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"github.com/capitalone/checks-out/envvars"
gh "github.com/capitalone/checks-out/remote/github"

log "github.com/Sirupsen/logrus"
"github.com/google/go-github/github"
log "github.com/sirupsen/logrus"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion exterror/exterror.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"fmt"
"reflect"

log "github.com/Sirupsen/logrus"
"github.com/mspiegel/go-multierror"
log "github.com/sirupsen/logrus"
)

type ExtError struct {
Expand Down
81 changes: 36 additions & 45 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@
module github.com/capitalone/checks-out

go 1.14

require (
github.com/BurntSushi/toml v0.3.0 // indirect
github.com/Sirupsen/logrus v0.11.5
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/dgrijalva/jwt-go v3.1.0+incompatible
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/elazarl/go-bindata-assetfs v1.0.0
github.com/franela/goblin v0.0.0-20170821161553-b962efd4bb2a
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
github.com/gin-gonic/gin v0.0.0-20170702092826-d459835d2b07
github.com/go-sql-driver/mysql v1.3.0
github.com/golang/protobuf v0.0.0-20170920220647-130e6b02ab05 // indirect
github.com/google/go-github v0.0.0-20180723152927-e1be32f26e66
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect
github.com/hashicorp/go-version v0.0.0-20170914154128-fc61389e27c7
github.com/hjson/hjson-go v0.2.3
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db
github.com/gin-gonic/gin v1.5.0
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.3.5 // indirect
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-github/v30 v30.0.0
github.com/hashicorp/go-version v1.2.0
github.com/hjson/hjson-go v3.0.1+incompatible
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133
github.com/joho/godotenv v1.2.0
github.com/joho/godotenv v1.3.0
github.com/json-iterator/go v1.1.9 // indirect
github.com/koding/cache v0.0.0-20161222233015-e8a81b0b3f20
github.com/kr/pretty v0.1.0 // indirect
github.com/lib/pq v0.0.0-20171019223007-456514e2defe
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 // indirect
github.com/mattn/go-isatty v0.0.3 // indirect
github.com/mattn/go-jsonpointer v0.0.0-20170427002117-a39417dc2a77
github.com/mattn/go-sqlite3 v1.2.0
github.com/mspiegel/go-multierror v0.0.0-20170309222903-065aa648c994
github.com/pelletier/go-toml v1.0.1
github.com/philhofer/fwd v1.0.0 // indirect
github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20 // indirect
github.com/rubenv/sql-migrate v0.0.0-20170824124545-79fe99e24311
github.com/russross/meddler v0.0.0-20170319163028-9515f6b01c15
github.com/stretchr/objx v0.0.0-20150928122152-1a9d0bb9f541 // indirect
github.com/stretchr/testify v1.1.4
github.com/tinylib/msgp v1.0.2 // indirect
github.com/ugorji/go v0.0.0-20171019201919-bdcc60b419d1 // indirect
github.com/ziutek/mymysql v1.5.4 // indirect
golang.org/x/net v0.0.0-20171019164906-aabf50738bcd // indirect
golang.org/x/oauth2 v0.0.0-20170928010508-bb50c06baba3
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
golang.org/x/sys v0.0.0-20171017063910-8dbc5d05d6ed // indirect
google.golang.org/appengine v1.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
gopkg.in/gorp.v1 v1.7.1 // indirect
gopkg.in/mgo.v2 v2.0.0-20160818020120-3f83fa500528 // indirect
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lib/pq v1.3.0
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-jsonpointer v0.0.1
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mspiegel/go-multierror v0.0.0-20171123200149-ea68e724609a
github.com/pelletier/go-toml v1.6.0
github.com/pkg/errors v0.9.1
github.com/rubenv/sql-migrate v0.0.0-20200212082348-64f95ea68aa3
github.com/russross/meddler v0.0.0-20191023082315-51a972bb8fb2
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.5.1
golang.org/x/crypto v0.0.0-20200317142112-1b76d66859c6 // indirect
golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d // indirect
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
Loading