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

[QT-577] Execute scenario sub-commands faster #101

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
223 changes: 71 additions & 152 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,34 @@
---

run:
# default concurrency is a available CPU number
# concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# list of build tags, all linters use it. Default is empty list.
# build-tags:

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
# skip-dirs:
# - src/external_libs
# - autogenerated_by_my_lib

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
# skip-files:
# - ".*\\.my\\.go$"
# - lib/bad.go

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
# modules-download-mode: readonly|vendor|mod

# Allow multiple parallel golangci-lint instances running.
# If false (default) - golangci-lint acquires file lock on start.
allow-parallel-runners: false


# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

# make issues output unique by line, default is true
uniq-by-line: true

# add a prefix to the output file references; default is no prefix
# path-prefix: ""

# sorts results by: filepath, line and column
sort-results: false


# all available settings of specific linters
linters-settings:

errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: true

# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
# ignore: fmt:.*,io/ioutil:^Read.*

# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
#exclude: /path/to/file.txt

cyclop:
# the maximal code complexity to report
max-complexity: 35
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
max-complexity: 30
package-average: 0.0
# should ignore tests (default false)
skip-tests: false

goimports:
Expand All @@ -112,97 +37,91 @@ linters-settings:
local-prefixes: github.com/hashicorp

gofumpt:
# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: false

govet:
# report about shadowed variables
check-shadowing: false
gosec:
excludes:
# Don't worry about decompression bombs, not relevant for our usage of zip
- G110
# Don't worry about zip file traversals
- G305
config:
G306:
# allow creating files with 0755 permissions
"0755"

# settings per analyzer
#settings:
# printf: # analyzer name, run `go tool vet help` to see all analyzers
# funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
interfacebloat:
max: 12

# enable or disable analyzers by name
# run `go tool vet help` to see all analyzers
#enable:
# - atomicalign
#enable-all: false
#disable:
# - shadow
#disable-all: false
nlreturn:
# Size of the block (including return statement that is still "OK")
block-size: 2

revive:
# see https://github.com/mgechev/revive#available-rules for details.
ignore-generated-header: true
severity: warning
#rules:
# - name: indent-error-flow
# severity: warning

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.19"

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.19"

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.19"

linters:
enable:
# defaults
enable-all: true
disable:
- containedctx
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- depguard
- dogsled
- dupl
- errname
- errorlint
- execinquery
- exhaustivestruct
- exhaustruct
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
# disabled for now
- gocritic
# disabled for now
- godox
- goerr113
- gofmt
- goheader
- golint
- gomnd
- ifshort
- importas
- interfacer
- ireturn
- lll
- loggercheck
- maintidx
- maligned
- musttag
- nakedret
- nestif
- nonamedreturns
- nosprintfhostport
- nosnakecase
- promlinter
- rowserrcheck
- scopelint
- sqlclosecheck
- structcheck
- typecheck
- unused
- tagliatelle
- testableexamples
- testpackage
# disabled because it's not friendly with the terraform test helper
- tparallel
- varcheck
# others
- gofumpt
- goimports
- asciicheck
- bodyclose
- cyclop
- stylecheck
- revive
disable-all: true
- varnamelen
- wrapcheck
- wsl
fast: false

severity:
# Default value is empty string.
# Set the default severity for issues. If severity rules are defined and the issues
# do not match or no severity is provided to the rule this will be the default
# severity applied. Severities should match the supported severity names of the
# selected out format.
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
# - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
# default-severity: error

# The default value is false.
# If set to true severity-rules regular expressions become case sensitive.
case-sensitive: false

# Default value is empty list.
# When a list of severity rules are provided, severity information will be added to lint
# issues. Severity rules have the same filtering capability as exclude rules except you
# are allowed to specify one matcher per severity rule.
# Only affects out formats that support setting severity information.
# rules:
# - linters:
# - dupl
# severity: info
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ BUILD_BINARY_PATH=${CURRENT_DIRECTORY}/dist/${BINARY}
REPO=github.com/hashicorp/enos
GO_BUILD_TAGS=-tags osusergo,netgo
GO_LD_FLAGS=-ldflags="-extldflags=-static -X ${REPO}/internal/version.Version=${VERSION} -X ${REPO}/internal/version.GitSHA=${GIT_SHA}"
GO_GC_FLAGS=-gcflags="all=-N -l"
GO_GC_FLAGS=
LINT_OUT_FORMAT?=colored-line-number
GORACE=GORACE=log_path=/tmp/enos-gorace.log
TEST_ACC=ENOS_ACC=1
TEST_ACC_EXT=ENOS_ACC=1 ENOS_EXT=1
Expand Down Expand Up @@ -47,9 +48,16 @@ lint: lint-golang lint-proto
lint-golang:
golangci-lint run -v

.PHONY: lint-fix
lint-fix: lint-fix-golang

.PHONY: lint-fix-golang
lint-fix-golang:
golangci-lint run -v --out-format=$(LINT_OUT_FORMAT) --fix

.PHONY: lint-proto
lint-proto:
pushd proto && buf lint
pushd proto && buf lint --error-format=$(LINT_OUT_FORMAT)

.PHONY: fmt
fmt: fmt-golang fmt-proto
Expand Down
Loading