Skip to content
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
99 changes: 59 additions & 40 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,68 @@
run:
deadline: 60s

version: "2"
linters:
default: standard
enable:
- contextcheck
- gci
- gofumpt
- gosec
- importas
- intrange
- misspell
- tparallel
- unparam

issues:
exclude-dirs:
- hack
exclude-rules:
- path: _test\.go
linters:
- errcheck

linters-settings:
gci:
no-inline-comments: true
no-prefix-comments: false
sections:
- standard
- default
- prefix(github.com/artefactual-sdps/preprocessing-base)
section-separators:
- newLine
gofumpt:
extra-rules: true
importas:
no-unaliased: true
no-extra-aliases: false
alias:
- pkg: go.temporal.io/sdk/contrib/(\w+)
alias: temporalsdk_contrib_$1
- pkg: go.temporal.io/sdk/(\w+)
alias: temporalsdk_$1
- pkg: go.temporal.io/api/(\w+)
alias: temporalapi_$1
gosec:
exclude-generated: false
severity: low
confidence: low
settings:
gosec:
severity: low
confidence: low
importas:
alias:
- pkg: go.temporal.io/sdk/contrib/(\w+)
alias: temporalsdk_contrib_$1
- pkg: go.temporal.io/sdk/(\w+)
alias: temporalsdk_$1
- pkg: go.temporal.io/api/(\w+)
alias: temporalapi_$1
no-unaliased: true
no-extra-aliases: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- errcheck
path: _test\.go
paths:
- hack
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofumpt
- golines
settings:
gci:
sections:
- standard
- default
- prefix(github.com/artefactual-sdps/preprocessing-base)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this was never added to the preprocessing-base references in https://github.com/artefactual-sdps/preprocessing-base?tab=readme-ov-file#create-a-new-repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

no-inline-comments: true
no-prefix-comments: false
gofumpt:
extra-rules: true
golines:
max-len: 120
shorten-comments: true
reformat-tags: true
chain-split-dots: true
exclusions:
generated: lax
paths:
- hack
- third_party$
- builtin$
- examples$
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ help:
'

lint: # @HELP Lint the project Go files with golangci-lint.
lint: OUT_FORMAT ?= colored-line-number
lint: LINT_FLAGS ?= --timeout=5m --fix
lint: LINT_FLAGS ?= --timeout=5m --fix --output.text.colors
lint: $(GOLANGCI_LINT)
golangci-lint run --out-format $(OUT_FORMAT) $(LINT_FLAGS)
golangci-lint run $(LINT_FLAGS)

list-tested-packages: # @HELP Print a list of packages being tested.
list-tested-packages:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ To create a new preprocessing child workflow project:
- The default Docker image name
- The Makefile project name and the location of the installed tools
- The `appName` in the worker command
- The gci "prefix" section in the `.golangci.yml` config file
- Update this readme file:
- Change the heading and initial description
- Remove the first three sections from the list above and the content
Expand Down
2 changes: 1 addition & 1 deletion hack/make/dep_golangci_lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(call _assert_var,UNAME_ARCH)
$(call _assert_var,CACHE_VERSIONS)
$(call _assert_var,CACHE_BIN)

GOLANGCI_LINT_VERSION ?= 1.64.8
GOLANGCI_LINT_VERSION ?= 2.8.0

ARCH := $(UNAME_ARCH)
ifeq ($(UNAME_ARCH),x86_64)
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func Read(config *Configuration, configFile string) (found bool, configFileUsed
}

if err := config.Validate(); err != nil {
return true, "", errors.Join(errors.New("invalid configuration:"), err)
return true, "", errors.Join(errors.New("invalid configuration"), err)
}

return true, v.ConfigFileUsed(), nil
Expand Down
6 changes: 3 additions & 3 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestConfig(t *testing.T) {
name: "Errors when configuration values are not valid",
configFile: "preprocessing.toml",
wantFound: true,
wantErr: `invalid configuration:
wantErr: `invalid configuration
SharedPath: missing required value
Temporal.TaskQueue: missing required value
Temporal.WorkflowName: missing required value`,
Expand All @@ -83,7 +83,7 @@ workflowName = "preprocessing"
maxConcurrentSessions = -1
`,
wantFound: true,
wantErr: `invalid configuration:
wantErr: `invalid configuration
Worker.MaxConcurrentSessions: -1 is less than the minimum value (1)`,
},
{
Expand All @@ -98,7 +98,7 @@ workflowName = "preprocessing"
checksumAlgorithm = "unknown"
`,
wantFound: true,
wantErr: `invalid configuration:
wantErr: `invalid configuration
Bagit.ChecksumAlgorithm: invalid value "unknown", must be one of (md5, sha1, sha256, sha512)`,
},
{
Expand Down
Loading