Skip to content

Commit 8c21c1f

Browse files
feat: add client for deepcode [IDE-175] (#10)
1 parent c5f9495 commit 8c21c1f

28 files changed

+2928
-649
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
executor: default
1515
steps:
1616
- checkout
17+
- run:
18+
name: Install tools
19+
command: make tools
1720
- run: make format
1821
- run:
1922
name: "Ensure go.mod is tidy"
@@ -25,6 +28,9 @@ jobs:
2528
executor: default
2629
steps:
2730
- checkout
31+
- run:
32+
name: Install tools
33+
command: make tools
2834
- run:
2935
name: Run unit tests
3036
command: make test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ output/
3535
*.log
3636
*.tmp
3737
*~
38+
logs/
3839

3940
#################################
4041
# OS generated files #
@@ -44,3 +45,4 @@ Thumbs.db
4445
.DS_Store
4546
._*
4647
webidentity.json
48+

.golangci.yaml

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ run:
33
- integration
44
concurrency: 4
55
issues-exit-code: 1
6-
skip-dirs: []
6+
skip-dirs:
7+
- "licenses"
8+
- "pact"
9+
- ".bin"
10+
- ".github"
11+
- ".vscode"
12+
- "build"
713
tests: true
814
timeout: 5m
915

@@ -25,10 +31,10 @@ linters-settings:
2531
gocyclo:
2632
min-complexity: 15
2733
gofumpt:
28-
module-path: github.com/snyk/go-application-framework
34+
module-path: github.com/snyk/code-client-go
2935
extra-rules: true
3036
goimports:
31-
local-prefixes: github.com/snyk/go-application-framework
37+
local-prefixes: github.com/snyk/code-client-go
3238
gosimple:
3339
checks: ['all']
3440
govet:
@@ -93,53 +99,77 @@ linters:
9399
- asciicheck
94100
- bidichk
95101
- bodyclose
96-
- containedctx
97-
- contextcheck
102+
# TODO(containedctx): revisit!
103+
#- containedctx
104+
# TODO(contextcheck): revisit
105+
#- contextcheck
98106
- dogsled
99107
- dupl
100108
- durationcheck
101109
- errname
102-
- errorlint
110+
# TODO(errorlint): revisit
111+
#- errorlint
103112
- exhaustive
104113
- exportloopref
105-
- forbidigo
106-
- forcetypeassert
107-
- goconst
108-
- gocritic
114+
# TODO(forbidigo): revisit
115+
#- forbidigo
116+
# TODO(forcetypeassert): revisit this one! beware fragile asserts in this codebase
117+
#- forcetypeassert
118+
# TODO(goconst): revisit
119+
#- goconst
120+
# TODO(gocritic): revisit
121+
#- gocritic
109122
- gocyclo
110-
- godot
111-
- gofumpt
112-
- goimports
123+
# TODO(godot): revisit
124+
#- godot
125+
# TODO(gofumpt): revisit
126+
#- gofumpt
127+
# TODO(goimports): revisit
128+
#- goimports
113129
- goprintffuncname
114-
- gosec
115-
- interfacebloat
116-
- ireturn
117-
- lll
130+
# TODO(gosec): revisit; consequences of revoking non-owner file permissions?
131+
#- gosec
132+
# TODO(interfacebloat): revisit in a followup; will require a breaking API change
133+
#- interfacebloat
134+
# TODO(ireturn): revisit in a followup; will require a breaking API change
135+
#- ireturn
136+
# TODO(lll): revisit in followup; formatting
137+
#- lll
118138
- misspell
119139
- nakedret
120-
- nestif
121-
- nilerr
122-
- nilnil
123-
- noctx
140+
# TODO(nestif): revisit in a followup; refactor will need more careful review
141+
#- nestif
142+
# TODO(nilerr): revisit; some tricky inversion of err in tests
143+
#- nilerr
144+
# TODO(nilnil): revisit
145+
#- nilnil
146+
# TODO(noctx): revisit in a followup; context lifecycle consequences and/or breaking API change
147+
#- noctx
124148
- nolintlint
125-
- prealloc
149+
# TODO(prealloc): revisit in a followup; some logic around slices are ignoring errors
150+
#- prealloc
126151
- predeclared
127152
- promlinter
128-
- revive
153+
# TODO(revive): revisit in a followup; extensive changes, some breaking. godoc requirement would be good to introduce
154+
#- revive
129155
- rowserrcheck
130156
- sqlclosecheck
131-
- stylecheck
132-
- tagliatelle
157+
# TODO(stylecheck): revisit in a followup; some breaking API changes
158+
#- stylecheck
159+
# NOTE: removed tagliatelle as it conflicts too much with existing API wireformats
133160
- tenv
134-
- testpackage
161+
# TODO(testpackage): improve open vs closed-box testing in a followup
162+
#- testpackage
135163
- thelper
136164
- tparallel
137165
- unconvert
138-
- unparam
166+
# TODO(unparam): revisit
167+
#- unparam
139168
- usestdlibvars
140169
- wastedassign
141170
- whitespace
142-
- wrapcheck
171+
# TODO(wrapcheck): wrap errors in a followup
172+
#- wrapcheck
143173

144174
issues:
145175
exclude-rules:
@@ -152,6 +182,10 @@ issues:
152182
- path: test/
153183
linters:
154184
- testpackage
185+
- path: \.go
186+
# TODO: remove this soon; unchecked errors are BAD
187+
linters:
188+
- errcheck
155189
include:
156190
- EXC0012
157191
- EXC0014

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ GOARCH = $(shell go env GOARCH)
55
TOOLS_BIN := $(shell pwd)/.bin
66

77
OVERRIDE_GOCI_LINT_V := v1.55.2
8+
PACT_V := 2.4.2
9+
10+
SHELL:=env PATH=$(TOOLS_BIN)/go:$(TOOLS_BIN)/pact/bin:$(PATH) $(SHELL)
811

912
## tools: Install required tooling.
1013
.PHONY: tools
11-
tools: $(TOOLS_BIN)/golangci-lint
12-
14+
tools: $(TOOLS_BIN)/golangci-lint $(TOOLS_BIN)/go $(TOOLS_BIN)/pact/bin/pact
1315
$(TOOLS_BIN)/golangci-lint:
1416
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(OVERRIDE_GOCI_LINT_V)/install.sh | sh -s -- -b $(TOOLS_BIN)/ $(OVERRIDE_GOCI_LINT_V)
1517

18+
$(TOOLS_BIN)/go:
19+
mkdir -p ${TOOLS_BIN}/go
20+
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % sh -c 'GOBIN=${TOOLS_BIN}/go go install %'
21+
22+
$(TOOLS_BIN)/pact/bin/pact:
23+
cd $(TOOLS_BIN); curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/v$(PACT_V)/install.sh | PACT_CLI_VERSION=v$(PACT_V) bash
24+
1625
.PHONY: format
1726
format:
1827
@gofmt -w -l -e .
@@ -47,7 +56,7 @@ testv:
4756
@go test -v ./...
4857

4958
.PHONY: generate
50-
generate:
59+
generate: $(TOOLS_BIN)/go/mockgen
5160
@go generate ./...
5261

5362
.PHONY: help

go.mod

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,71 @@ module github.com/snyk/code-client-go
22

33
go 1.21.7
44

5-
require github.com/stretchr/testify v1.8.4
5+
require (
6+
github.com/golang/mock v1.6.0
7+
github.com/google/uuid v1.6.0
8+
github.com/pact-foundation/pact-go v1.7.0
9+
github.com/pkg/errors v0.9.1
10+
github.com/rs/zerolog v1.32.0
11+
github.com/snyk/snyk-ls v0.0.0-20240313154204-cd9e82b13dfb
12+
github.com/stretchr/testify v1.8.4
13+
golang.org/x/net v0.22.0
14+
)
615

716
require (
8-
github.com/davecgh/go-spew v1.1.1 // indirect
9-
github.com/pmezard/go-difflib v1.0.0 // indirect
17+
github.com/adrg/xdg v0.4.0 // indirect
18+
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa // indirect
19+
github.com/creachadair/jrpc2 v1.1.2 // indirect
20+
github.com/creachadair/mds v0.12.2 // indirect
21+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
22+
github.com/denisbrodbeck/machineid v1.0.1 // indirect
23+
github.com/fatih/color v1.16.0 // indirect
24+
github.com/fsnotify/fsnotify v1.7.0 // indirect
25+
github.com/golang/protobuf v1.5.4 // indirect
26+
github.com/hashicorp/go-uuid v1.0.3 // indirect
27+
github.com/hashicorp/go-version v1.6.0 // indirect
28+
github.com/hashicorp/hcl v1.0.0 // indirect
29+
github.com/hashicorp/logutils v1.0.0 // indirect
30+
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
31+
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
32+
github.com/jcmturner/gofork v1.7.6 // indirect
33+
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
34+
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
35+
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
36+
github.com/magiconair/properties v1.8.7 // indirect
37+
github.com/mattn/go-colorable v0.1.13 // indirect
38+
github.com/mattn/go-isatty v0.0.20 // indirect
39+
github.com/mitchellh/mapstructure v1.5.0 // indirect
40+
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
41+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
42+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
43+
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
44+
github.com/sagikazarmark/locafero v0.4.0 // indirect
45+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
46+
github.com/snyk/go-application-framework v0.0.0-20240111143643-fa847b8a9a3b // indirect
47+
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 // indirect
48+
github.com/sourcegraph/conc v0.3.0 // indirect
49+
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd // indirect
50+
github.com/spf13/afero v1.11.0 // indirect
51+
github.com/spf13/cast v1.6.0 // indirect
52+
github.com/spf13/pflag v1.0.5 // indirect
53+
github.com/spf13/viper v1.18.2 // indirect
54+
github.com/subosito/gotenv v1.6.0 // indirect
55+
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
56+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
57+
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
58+
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
59+
go.uber.org/multierr v1.11.0 // indirect
60+
golang.org/x/crypto v0.21.0 // indirect
61+
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
62+
golang.org/x/mod v0.16.0 // indirect
63+
golang.org/x/oauth2 v0.18.0 // indirect
64+
golang.org/x/sync v0.6.0 // indirect
65+
golang.org/x/sys v0.18.0 // indirect
66+
golang.org/x/text v0.14.0 // indirect
67+
golang.org/x/tools v0.19.0 // indirect
68+
google.golang.org/appengine v1.6.8 // indirect
69+
google.golang.org/protobuf v1.33.0 // indirect
70+
gopkg.in/ini.v1 v1.67.0 // indirect
1071
gopkg.in/yaml.v3 v3.0.1 // indirect
1172
)

0 commit comments

Comments
 (0)