Skip to content

Commit dd60bac

Browse files
Go reportcard (#45)
* improvement of code based on golint suggestion * Comment improvments based on goreport suggestions * more updates to comment based on goreportcard * Adding download badge * Add go report card badge
1 parent 88ef547 commit dd60bac

21 files changed

+851
-101
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ codecov_tests:
5151
MOCK_DATA_TEST_RUNNER=$(MOCK_DATA_TEST_RUNNER) PGPASSWORD=$(PGPASSWORD) PGDATABASE=$(PGDATABASE) PGUSER=$(PGUSER) PGHOST=$(PGHOST) PGPORT=$(PGPORT) GOFLAGS="-count=1" go test -v . -coverprofile=coverage.txt -covermode=atomic
5252
@echo "#### Finished Mock Data Test"
5353
make drop_db
54-
.PHONY: unit_tests
54+
.PHONY: codecov_tests
5555

5656
# Run all mock data test
5757
tests:

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Mock Data [![go version](https://img.shields.io/github/go-mod/go-version/pivotal-gss/mock-data?filename=go.mod&style=flat&logo=go&label=Go)](https://golang.org/dl/) [![CI](https://img.shields.io/github/workflow/status/pivotal-gss/mock-data/CI?logo=github&style=flat&label=CI)](https://github.com/pivotal-gss/mock-data/actions/workflows/ci.yml) [![CI](https://img.shields.io/github/workflow/status/pivotal-gss/mock-data/Tests?logo=github&style=flat&label=Tests)](https://github.com/pivotal-gss/mock-data/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/pivotal-gss/mock-data/branch/master/graph/badge.svg)](https://codecov.io/gh/pivotal-gss/mock-data) [![Go Report Card](https://goreportcard.com/badge/github.com/pivotal-gss/mock-data?logo=go)](https://goreportcard.com/report/github.com/pivotal-gss/mock-data)
2-
1+
# Mock Data [![go version](https://img.shields.io/github/go-mod/go-version/pivotal-gss/mock-data?filename=go.mod&style=flat&logo=go&label=Go)](https://golang.org/dl/) [![CI](https://img.shields.io/github/workflow/status/pivotal-gss/mock-data/CI?logo=github&style=flat&label=CI)](https://github.com/pivotal-gss/mock-data/actions/workflows/ci.yml) [![CI](https://img.shields.io/github/workflow/status/pivotal-gss/mock-data/Tests?logo=github&style=flat&label=Tests)](https://github.com/pivotal-gss/mock-data/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/pivotal-gss/mock-data/branch/master/graph/badge.svg)](https://codecov.io/gh/pivotal-gss/mock-data) [![Go Report Card](https://goreportcard.com/badge/github.com/pivotal-gss/mock-data?logo=go)](https://goreportcard.com/report/github.com/pivotal-gss/mock-data) [![Github Releases Stats of mock-data](https://img.shields.io/github/downloads/pivotal-gss/mock-data/total.svg?logo=github&label=Downloads)](https://somsubhra.github.io/github-release-stats/?username=pivotal-gss&repository=mock-data)
32
Here are my tables
43
Load them [with data] for me
54
I don't care how
@@ -124,9 +123,9 @@ provided `/usr/local/bin` is part of the $PATH environment variable.
124123
```
125124
docker image tag ghcr.io/pivotal-gss/mock-data mock
126125
```
127-
+ For mac users to connect to the host database you can run the below command
126+
+ For mac users to connect to the host (or local host) database you can run the below command
128127
```
129-
docker run mock -a host.docker.internal <flags...>
128+
docker run mock [subcommand] -a host.docker.internal <flags...>
130129
```
131130
eg
132131
```
@@ -182,11 +181,11 @@ To customize this repository, follow the steps
182181
```
183182
go run . <commands> <flags.........>
184183
```
185-
6. Run the golang linter to analyzes & fix source code to flag programming errors, bugs, stylistic errors, and suspicious constructs.
184+
6. [Recommended] Run the golang linter to analyzes & fix source code programming errors, bugs, stylistic errors, and suspicious constructs.
186185
```
187186
golangci-lint run
188187
```
189-
to install golangci-lint check [here](https://golangci-lint.run/usage/install/), config file `.golangci.yml` is provided with the repo
188+
to install golangci-lint check [here](https://golangci-lint.run/usage/install/), config file `.golangci.yml` has been provided with this repo
190189
7. To run test, use
191190
```
192191
# Edit the database environment variables on the "Makefile"

cmd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var (
1212
cmdOptions Command
1313
)
1414

15-
// Command: Root command line options
15+
// Command the root command line options
1616
type Command struct {
1717
Debug bool
1818
Username string
@@ -30,13 +30,13 @@ type Command struct {
3030
URI string
3131
}
3232

33-
// Database command line options
33+
// Database sub command line options
3434
type Database struct {
3535
FakeDB bool
3636
FakeDBTableRows bool
3737
}
3838

39-
// Tables: Table command line options
39+
// Tables sub command line options
4040
type Tables struct {
4141
FakeNewTables bool
4242
TotalTables int

constraintsRestore_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func TestFixPKey(t *testing.T) {
6868
})
6969
t.Run("check_for_any_available_constraint_"+conStr, func(t *testing.T) {
7070
if got := len(data); got <= 0 {
71-
t.Errorf("TestFixPKey = %v, want > 0 %v constriants", got, conStr)
71+
t.Errorf("TestFixPKey = %v, want > 0 %v constraints", got, conStr)
7272
}
7373
})
7474
for _, ck := range data {
@@ -116,7 +116,7 @@ func TestFixFKey(t *testing.T) {
116116
})
117117
t.Run("check_for_any_available_constraint_FOREIGN", func(t *testing.T) {
118118
if got := len(data); got <= 0 {
119-
t.Errorf("TestFixFKey = %v, want > 0 %v constriants", got, "FOREIGN")
119+
t.Errorf("TestFixFKey = %v, want > 0 %v constraints", got, "FOREIGN")
120120
}
121121
})
122122
for _, ck := range data {

0 commit comments

Comments
 (0)