Skip to content

Commit 0356964

Browse files
authored
Enable CodeClimate (#3)
* Enable CodeClimate * Add .git to CircleCI workspace for CodeClimate * Update CircleCI for CodeClimate
1 parent 5e97bc8 commit 0356964

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed

.circleci/config.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
name: Install dependencies
2727
command: dep ensure
2828

29+
- run:
30+
name: Install CodeClimate CLI
31+
command: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && chmod +x ./cc-test-reporter
32+
2933
- save_cache:
3034
key: deps1-{{ .Branch }}-{{ checksum "Gopkg.toml" }}
3135
paths:
@@ -34,9 +38,11 @@ jobs:
3438
- persist_to_workspace:
3539
root: .
3640
paths:
41+
- cc-test-reporter
3742
- Makefile
3843
- vendor
3944
- "*.go"
45+
- .git
4046

4147
test:
4248
<<: *defaults
@@ -45,14 +51,18 @@ jobs:
4551
- attach_workspace:
4652
at: .
4753

54+
- run:
55+
name: Notify CodeClimate about pending report
56+
command: ./cc-test-reporter before-build
57+
4858
- run:
4959
name: Run tests
5060
command: make test
5161

5262
- persist_to_workspace:
5363
root: .
5464
paths:
55-
- coverage.out
65+
- c.out
5666

5767
coverage:
5868
<<: *defaults
@@ -62,8 +72,8 @@ jobs:
6272
at: .
6373

6474
- run:
65-
name: Update Coveralls.io
66-
command: make coveralls
75+
name: Notify CodeClimate about finished build
76+
command: ./cc-test-reporter after-build --coverage-input-type gocov
6777

6878
workflows:
6979
version: 2

.codeclimate.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins:
2+
gofmt:
3+
enabled: true
4+
golint:
5+
enabled: true
6+
govet:
7+
enabled: true

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
coverage.out
2-
vendor
1+
.DS_Store
2+
3+
c.out
4+
coverage
5+
vendor

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
test:
2-
@ go test -cover -coverprofile=coverage.out -race ./...
2+
@ go test -cover -coverprofile=c.out -race ./...
33

4-
coveralls:
5-
@ goveralls -coverprofile=coverage.out -service=circle-ci -repotoken=$(COVERALLS_TOKEN)
6-
7-
.PHONY: test coverall
4+
.PHONY: test

router_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ func TestRouteMustBeFunction(t *testing.T) {
4444
assert.Equal(t, "Handler is not a function, but bool", err.Error())
4545
}
4646

47-
func TestRouteMatch(t *testing.T) {
47+
func TestRouteMatchA(t *testing.T) {
4848
routeA, err := r.Serve(router.Request{
4949
Field: "fieldA",
5050
Arguments: json.RawMessage("{\"foo\":\"bar\"}"),
5151
})
5252

5353
assert.Nil(t, routeA)
5454
assert.Equal(t, "Nothing here in route A: bar", err.Error())
55+
}
5556

57+
func TestRouteMatchB(t *testing.T) {
5658
routeB, err := r.Serve(router.Request{
5759
Field: "fieldB",
5860
Arguments: json.RawMessage("{\"bar\":\"foo\"}"),

0 commit comments

Comments
 (0)