Skip to content

Commit

Permalink
chore: enable context-as-argument from revive linter
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
  • Loading branch information
mmorel-35 committed Jan 24, 2025
1 parent 8b5211f commit a0be989
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
48 changes: 46 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ linters:
- nolintlint
- nakedret
- perfsprint
- revive
- testifylint
- thelper
- usestdlibvars

linters-settings:
nakedret:
max-func-lines: 0
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
# See the https://github.com/polyfloyd/go-errorlint for caveats.
Expand All @@ -31,6 +30,51 @@ linters-settings:
- standard
- default
- prefix(github.com/testcontainers)
nakedret:
max-func-lines: 0
revive:
min-confidence: 0.8
rules:
- name: blank-imports
- name: context-as-argument
arguments:
- allowTypesBefore: "*testing.T"
- name: context-keys-type
- name: dot-imports
- name: early-return
disabled: true
arguments:
- "preserveScope"
- name: empty-block
disabled: true
- name: error-naming
disabled: true
- name: error-return
- name: error-strings
disabled: true
- name: errorf
- name: increment-decrement
- name: indent-error-flow
disabled: true
- name: range
- name: receiver-naming
- name: redefines-builtin-id
disabled: true
- name: superfluous-else
arguments:
- "preserveScope"
- name: time-naming
- name: unexported-return
disabled: true
- name: unreachable-code
- name: unused-parameter
disabled: true
- name: use-any
disabled: true
- name: var-declaration
disabled: true
- name: var-naming
disabled: true
testifylint:
disable:
- float-compare
Expand Down
8 changes: 4 additions & 4 deletions modulegen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func TestGenerate(t *testing.T) {
assertModuleContent(t, module, filepath.Join(generatedTemplatesDir, moduleNameLower+".go"))
assertGoModContent(t, module, originalConfig.Extra.LatestVersion, filepath.Join(generatedTemplatesDir, "go.mod"))
assertMakefileContent(t, module, filepath.Join(generatedTemplatesDir, "Makefile"))
assertMkdocsNavItems(t, module, originalConfig, tmpCtx)
assertMkdocsNavItems(t, tmpCtx, module, originalConfig)
}

func TestGenerateModule(t *testing.T) {
Expand Down Expand Up @@ -352,7 +352,7 @@ func TestGenerateModule(t *testing.T) {
assertModuleContent(t, module, filepath.Join(generatedTemplatesDir, moduleNameLower+".go"))
assertGoModContent(t, module, originalConfig.Extra.LatestVersion, filepath.Join(generatedTemplatesDir, "go.mod"))
assertMakefileContent(t, module, filepath.Join(generatedTemplatesDir, "Makefile"))
assertMkdocsNavItems(t, module, originalConfig, tmpCtx)
assertMkdocsNavItems(t, tmpCtx, module, originalConfig)
}

// assert content module file in the docs
Expand Down Expand Up @@ -480,9 +480,9 @@ func assertMakefileContent(t *testing.T, module context.TestcontainersModule, ma
}

// assert content in the nav items from mkdocs.yml
func assertMkdocsNavItems(t *testing.T, module context.TestcontainersModule, originalConfig *mkdocs.Config, tmpCtx context.Context) {
func assertMkdocsNavItems(t *testing.T, ctx context.Context, module context.TestcontainersModule, originalConfig *mkdocs.Config) {
t.Helper()
config, err := mkdocs.ReadConfig(tmpCtx.MkdocsConfigFile())
config, err := mkdocs.ReadConfig(ctx.MkdocsConfigFile())
require.NoError(t, err)

parentDir := module.ParentDir()
Expand Down

0 comments on commit a0be989

Please sign in to comment.