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

Add DevContainers support #117

Merged
merged 3 commits into from
Feb 13, 2025
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
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "xk6-sql",
"image": "mcr.microsoft.com/devcontainers/base:1-bookworm",
"customizations": {
"vscode": {
"settings": {
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"]
},
"extensions": [
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"jetmartin.bats",
"mads-hartmann.bash-ide-vscode",
"foxundermoon.shell-format"
]
}
},

"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.23",
"golangciLintVersion": "1.63.4"
},
"ghcr.io/guiyomh/features/goreleaser:0": { "version": "2.6.1" },
"ghcr.io/michidk/devcontainers-features/bun:1": { "version": "1.2.1" },
"ghcr.io/szkiba/devcontainer-features/cdo:1": { "version": "0.1.2" },
"ghcr.io/szkiba/devcontainer-features/mdcode:1": { "version": "0.2.0" },
"ghcr.io/szkiba/devcontainer-features/bats:1": { "version": "1.11.1" },
"ghcr.io/grafana/devcontainer-features/xk6:1": { "version": "0.14.0" }
},

"remoteEnv": {
"GH_TOKEN": "${localEnv:GH_TOKEN}",
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
}
}
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true

[*.{yml,yaml,json,sh,bats}]
indent_size = 2
trim_trailing_whitespace = true

[Makefile]
indent_style = tab
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/k6
/k6.exe
/coverage.out
/coverage.txt
/build
/node_modules
yarn.lock
Expand Down
147 changes: 22 additions & 125 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,133 +1,30 @@
# v1.57.2
# Please don't remove the first line. It uses in CI to determine the golangci version
run:
timeout: 5m
# v1.63.4
# Please don't remove the first line. This is a must until the reusable GitHub workflow is refactored.

issues:
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

# We want to try and improve the comments in the k6 codebase, so individual
# non-golint items from the default exclusion list will gradually be added
# to the exclude-rules below
exclude-use-default: false

exclude-rules:
# Exclude duplicate code and function length and complexity checking in test
# files (due to common repeats and long functions in test code)
- path: _(test|gen)\.go
linters:
- cyclop
- dupl
- gocognit
- funlen
- lll
- forcetypeassert
- path: js\/modules\/k6\/html\/.*\.go
text: "exported: exported "
linters:
- revive
- path: js\/modules\/k6\/http\/.*_test\.go
linters:
# k6/http module's tests are quite complex because they often have several nested levels.
# The module is in maintainance mode, so we don't intend to port the tests to a parallel version.
- paralleltest
- tparallel
- linters:
- staticcheck # Tracked in https://github.com/grafana/xk6-grpc/issues/14
text: "The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated."
- linters:
- forbidigo
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden'

linters-settings:
exhaustive:
default-signifies-exhaustive: true
cyclop:
max-complexity: 25
dupl:
threshold: 150
goconst:
min-len: 10
min-occurrences: 4
funlen:
lines: 80
statements: 60
forbidigo:
forbid:
- '^(fmt\\.Print(|f|ln)|print|println)$'
# Forbid everything in os, except os.Signal and os.SyscalError
- '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?'
# Forbid everything in syscall except the uppercase constants
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?'
- '^logrus\.Logger$'

linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- cyclop
- dogsled
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
enable-all: true
disable:
- wrapcheck
- varnamelen
- exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gocheckcompilerdirectives
- gochecknoglobals
- gocognit
- goconst
- gocritic
- gofmt
- gofumpt
- goimports
- gomoddirectives
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- interfacebloat
- lll
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- revive
- reassign
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- tenv
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
fast: false
- gochecknoinits
- ireturn

linters-settings:
depguard:
rules:
prevent_accidental_imports:
allow:
- $gostd
- github.com/brianvoe/gofakeit/v6
- github.com/stretchr/testify/require
- github.com/grafana/sobek
- github.com/grafana/k6
- github.com/grafana/xk6-sql
- github.com/proullon/ramsql/driver
Loading
Loading