Skip to content

Commit

Permalink
Merge pull request #49 from grafana/48-add-devcontainers-support
Browse files Browse the repository at this point in the history
Add DevContainers support
  • Loading branch information
szkiba authored Feb 12, 2025
2 parents 8572929 + 3bac787 commit 98b584a
Show file tree
Hide file tree
Showing 20 changed files with 244 additions and 214 deletions.
41 changes: 41 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "xk6-faker",
"image": "mcr.microsoft.com/devcontainers/base:1-bookworm",
"customizations": {
"vscode": {
"settings": {
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.buildTags": "codegen"
},
"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
Expand Up @@ -4,4 +4,4 @@
/node_modules
yarn.lock
bun.lockb
/coverage.out
/coverage.txt
150 changes: 23 additions & 127 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,135 +1,31 @@
# v1.55.2
# Please don't remove the first line. It uses in CI to determine the golangci version
run:
deadline: 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
- 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:
nolintlint:
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: false
exhaustive:
default-signifies-exhaustive: true
govet:
check-shadowing: true
cyclop:
max-complexity: 25
maligned:
suggest-new: true
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
- lukechampine.com/frand
- github.com/iancoleman/strcase
- github.com/grafana/sobek
- github.com/grafana/k6
- github.com/grafana/xk6-faker
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

Loading

0 comments on commit 98b584a

Please sign in to comment.