Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo maintenance #62

Merged
merged 10 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ audit: ## run nancy auditor
go list -json -m all | nancy sleuth

.PHONY: lint
lint: ## doesn't really lint
exit
lint:
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run ./...

.PHONY: build
build:
Expand Down
93 changes: 93 additions & 0 deletions api/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# This file was inspired by the golangci-lint one:
# https://github.com/golangci/golangci-lint/blob/master/.golangci.yml
run:
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m
linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0
gocyclo:
min-complexity: 20
gocognit:
min-complexity: 40
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
misspell:
locale: UK
lll:
line-length: 140
gofmt:
simplify: false
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- wrapperFunc
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- hugeParam
- unnamedResult

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- depguard
- dogsled
- errcheck
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- revive
- gosec
- gosimple
- govet
- ineffassign
- nakedret
- staticcheck
- stylecheck
- typecheck
- unconvert
- unused
- whitespace
- gocognit
- prealloc

issues:
exclude-rules:
- path: _test\.go
linters:
- gocyclo
- errcheck
- dupl
- gosec
- linters:
- govet
text: 'declaration of "(err|ctx)" shadows declaration at'
new: false

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.53.3 # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
2 changes: 1 addition & 1 deletion ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image_resource:
type: docker-image
source:
repository: golang
tag: 1.19.2
tag: 1.20.5

inputs:
- name: dp-cantabular-metadata-extractor-api
Expand Down
2 changes: 1 addition & 1 deletion ci/component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image_resource:
type: docker-image
source:
repository: golang
tag: 1.19.2
tag: 1.20.5

inputs:
- name: dp-cantabular-metadata-extractor-api
Expand Down
2 changes: 1 addition & 1 deletion ci/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image_resource:
type: docker-image
source:
repository: golang
tag: 1.19.2
tag: 1.20.5

inputs:
- name: dp-cantabular-metadata-extractor-api
Expand Down
2 changes: 1 addition & 1 deletion ci/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image_resource:
type: docker-image
source:
repository: golang
tag: 1.19.2
tag: 1.20.5

inputs:
- name: dp-cantabular-metadata-extractor-api
Expand Down
3 changes: 3 additions & 0 deletions devstack/makerecp/createrecipe/createrecipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ dataset(name:"UR") {
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Print(err)
}

return !strings.Contains(string(body), "does not exist")

Expand Down
7 changes: 4 additions & 3 deletions features/steps/steps.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package steps

import (
"io"
"strings"

"github.com/cucumber/godog"
"github.com/stretchr/testify/assert"
"io/ioutil"
"strings"
)

func (c *Component) RegisterSteps(ctx *godog.ScenarioContext) {
Expand All @@ -15,7 +16,7 @@ func (c *Component) RegisterSteps(ctx *godog.ScenarioContext) {

func (c *Component) iShouldReceiveAHelloworldResponse() error {
responseBody := c.apiFeature.HttpResponse.Body
body, _ := ioutil.ReadAll(responseBody)
body, _ := io.ReadAll(responseBody)

assert.Equal(c, `{"message":"Hello, World!"}`, strings.TrimSpace(string(body)))

Expand Down
66 changes: 33 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
module github.com/ONSdigital/dp-cantabular-metadata-extractor-api

go 1.19
go 1.20

// Fix security issues
replace github.com/spf13/cobra => github.com/spf13/cobra v1.4.0

require (
github.com/ONSdigital/dp-api-clients-go/v2 v2.234.0
github.com/ONSdigital/dp-authorisation/v2 v2.28.0
github.com/ONSdigital/dp-component-test v0.7.0
github.com/ONSdigital/dp-healthcheck v1.5.0
github.com/ONSdigital/dp-api-clients-go/v2 v2.254.0
github.com/ONSdigital/dp-authorisation/v2 v2.30.0
github.com/ONSdigital/dp-component-test v0.9.2
github.com/ONSdigital/dp-healthcheck v1.6.1
github.com/ONSdigital/dp-net v1.5.0
github.com/ONSdigital/dp-net/v2 v2.8.0
github.com/ONSdigital/log.go/v2 v2.3.0
github.com/cucumber/godog v0.12.5
github.com/ONSdigital/dp-net/v2 v2.10.0
github.com/ONSdigital/log.go/v2 v2.4.1
github.com/cucumber/godog v0.12.6
github.com/gorilla/mux v1.8.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/pkg/errors v0.9.1
github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29
github.com/smartystreets/goconvey v1.7.2
github.com/stretchr/testify v1.8.0
github.com/smartystreets/goconvey v1.8.0
github.com/stretchr/testify v1.8.4
)

require (
github.com/ONSdigital/dp-api-clients-go v1.43.0 // indirect
github.com/ONSdigital/dp-mongodb-in-memory v1.3.1 // indirect
github.com/ONSdigital/dp-permissions-api v0.19.0 // indirect
github.com/ONSdigital/dp-mongodb-in-memory v1.6.0 // indirect
github.com/ONSdigital/dp-permissions-api v0.22.0 // indirect
github.com/aws/aws-sdk-go v1.44.204 // indirect
github.com/chromedp/cdproto v0.0.0-20211126220118-81fa0469ad77 // indirect
github.com/chromedp/chromedp v0.7.6 // indirect
github.com/chromedp/cdproto v0.0.0-20230419194459-b5ff65bc57a3 // indirect
github.com/chromedp/chromedp v0.9.1 // indirect
github.com/chromedp/sysutil v1.0.0 // indirect
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
github.com/cucumber/messages-go/v16 v16.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/gobwas/ws v1.1.0 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/gobwas/ws v1.2.0 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-memdb v1.3.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.4 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/justinas/alice v1.2.0 // indirect
github.com/klauspost/compress v1.15.6 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/maxcnunes/httpfake v1.2.4 // indirect
github.com/montanaflynn/stats v0.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v1.13.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/smartystreets/assertions v1.13.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.1 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
go.mongodb.org/mongo-driver v1.9.1 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
go.mongodb.org/mongo-driver v1.11.4 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading