Skip to content

Commit

Permalink
feat: add client for deepcode [IDE-175] (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
teodora-sandu committed Mar 14, 2024
1 parent c5f9495 commit 8c21c1f
Show file tree
Hide file tree
Showing 28 changed files with 2,928 additions and 649 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
executor: default
steps:
- checkout
- run:
name: Install tools
command: make tools
- run: make format
- run:
name: "Ensure go.mod is tidy"
Expand All @@ -25,6 +28,9 @@ jobs:
executor: default
steps:
- checkout
- run:
name: Install tools
command: make tools
- run:
name: Run unit tests
command: make test
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ output/
*.log
*.tmp
*~
logs/

#################################
# OS generated files #
Expand All @@ -44,3 +45,4 @@ Thumbs.db
.DS_Store
._*
webidentity.json

90 changes: 62 additions & 28 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ run:
- integration
concurrency: 4
issues-exit-code: 1
skip-dirs: []
skip-dirs:
- "licenses"
- "pact"
- ".bin"
- ".github"
- ".vscode"
- "build"
tests: true
timeout: 5m

Expand All @@ -25,10 +31,10 @@ linters-settings:
gocyclo:
min-complexity: 15
gofumpt:
module-path: github.com/snyk/go-application-framework
module-path: github.com/snyk/code-client-go
extra-rules: true
goimports:
local-prefixes: github.com/snyk/go-application-framework
local-prefixes: github.com/snyk/code-client-go
gosimple:
checks: ['all']
govet:
Expand Down Expand Up @@ -93,53 +99,77 @@ linters:
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
# TODO(containedctx): revisit!
#- containedctx
# TODO(contextcheck): revisit
#- contextcheck
- dogsled
- dupl
- durationcheck
- errname
- errorlint
# TODO(errorlint): revisit
#- errorlint
- exhaustive
- exportloopref
- forbidigo
- forcetypeassert
- goconst
- gocritic
# TODO(forbidigo): revisit
#- forbidigo
# TODO(forcetypeassert): revisit this one! beware fragile asserts in this codebase
#- forcetypeassert
# TODO(goconst): revisit
#- goconst
# TODO(gocritic): revisit
#- gocritic
- gocyclo
- godot
- gofumpt
- goimports
# TODO(godot): revisit
#- godot
# TODO(gofumpt): revisit
#- gofumpt
# TODO(goimports): revisit
#- goimports
- goprintffuncname
- gosec
- interfacebloat
- ireturn
- lll
# TODO(gosec): revisit; consequences of revoking non-owner file permissions?
#- gosec
# TODO(interfacebloat): revisit in a followup; will require a breaking API change
#- interfacebloat
# TODO(ireturn): revisit in a followup; will require a breaking API change
#- ireturn
# TODO(lll): revisit in followup; formatting
#- lll
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
# TODO(nestif): revisit in a followup; refactor will need more careful review
#- nestif
# TODO(nilerr): revisit; some tricky inversion of err in tests
#- nilerr
# TODO(nilnil): revisit
#- nilnil
# TODO(noctx): revisit in a followup; context lifecycle consequences and/or breaking API change
#- noctx
- nolintlint
- prealloc
# TODO(prealloc): revisit in a followup; some logic around slices are ignoring errors
#- prealloc
- predeclared
- promlinter
- revive
# TODO(revive): revisit in a followup; extensive changes, some breaking. godoc requirement would be good to introduce
#- revive
- rowserrcheck
- sqlclosecheck
- stylecheck
- tagliatelle
# TODO(stylecheck): revisit in a followup; some breaking API changes
#- stylecheck
# NOTE: removed tagliatelle as it conflicts too much with existing API wireformats
- tenv
- testpackage
# TODO(testpackage): improve open vs closed-box testing in a followup
#- testpackage
- thelper
- tparallel
- unconvert
- unparam
# TODO(unparam): revisit
#- unparam
- usestdlibvars
- wastedassign
- whitespace
- wrapcheck
# TODO(wrapcheck): wrap errors in a followup
#- wrapcheck

issues:
exclude-rules:
Expand All @@ -152,6 +182,10 @@ issues:
- path: test/
linters:
- testpackage
- path: \.go
# TODO: remove this soon; unchecked errors are BAD
linters:
- errcheck
include:
- EXC0012
- EXC0014
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ GOARCH = $(shell go env GOARCH)
TOOLS_BIN := $(shell pwd)/.bin

OVERRIDE_GOCI_LINT_V := v1.55.2
PACT_V := 2.4.2

SHELL:=env PATH=$(TOOLS_BIN)/go:$(TOOLS_BIN)/pact/bin:$(PATH) $(SHELL)

## tools: Install required tooling.
.PHONY: tools
tools: $(TOOLS_BIN)/golangci-lint

tools: $(TOOLS_BIN)/golangci-lint $(TOOLS_BIN)/go $(TOOLS_BIN)/pact/bin/pact
$(TOOLS_BIN)/golangci-lint:
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(OVERRIDE_GOCI_LINT_V)/install.sh | sh -s -- -b $(TOOLS_BIN)/ $(OVERRIDE_GOCI_LINT_V)

$(TOOLS_BIN)/go:
mkdir -p ${TOOLS_BIN}/go
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % sh -c 'GOBIN=${TOOLS_BIN}/go go install %'

$(TOOLS_BIN)/pact/bin/pact:
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

.PHONY: format
format:
@gofmt -w -l -e .
Expand Down Expand Up @@ -47,7 +56,7 @@ testv:
@go test -v ./...

.PHONY: generate
generate:
generate: $(TOOLS_BIN)/go/mockgen
@go generate ./...

.PHONY: help
Expand Down
67 changes: 64 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,71 @@ module github.com/snyk/code-client-go

go 1.21.7

require github.com/stretchr/testify v1.8.4
require (
github.com/golang/mock v1.6.0
github.com/google/uuid v1.6.0
github.com/pact-foundation/pact-go v1.7.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.32.0
github.com/snyk/snyk-ls v0.0.0-20240313154204-cd9e82b13dfb
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.22.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa // indirect
github.com/creachadair/jrpc2 v1.1.2 // indirect
github.com/creachadair/mds v0.12.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/snyk/go-application-framework v0.0.0-20240111143643-fa847b8a9a3b // indirect
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 8c21c1f

Please sign in to comment.