Skip to content

Commit 8fc2205

Browse files
committed
Merge branch 'master' into releases/1.6.x
2 parents 72b4354 + c161eb2 commit 8fc2205

File tree

208 files changed

+13759
-1317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+13759
-1317
lines changed

Diff for: .github/workflows/docker-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
cd docker/test
7171
uv sync --all-extras --dev --locked
7272
uv run ruff check
73+
uv run basedpyright
7374
uv run pytest tests -n 1 --durations=0 --color=yes
7475
env:
7576
CROWDSEC_TEST_VERSION: test

Diff for: .github/workflows/go-tests-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ jobs:
6161
- name: golangci-lint
6262
uses: golangci/golangci-lint-action@v6
6363
with:
64-
version: v1.63
64+
version: v1.64
6565
args: --issues-exit-code=1 --timeout 10m
6666
only-new-issues: false

Diff for: .github/workflows/go-tests.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ jobs:
184184
run: |
185185
make build BUILD_PROFILE=minimal
186186
187-
- name: Run tests again, dynamic
187+
- name: Ensure we can do a dynamic build, without tests
188188
run: |
189189
make clean build
190-
set -o pipefail
191-
make go-acc | sed 's/ *coverage:.*of statements in.*//' | richgo testfilter
192190
193191
- name: Upload unit coverage to Codecov
194192
uses: codecov/codecov-action@v4
@@ -200,6 +198,6 @@ jobs:
200198
- name: golangci-lint
201199
uses: golangci/golangci-lint-action@v6
202200
with:
203-
version: v1.63
201+
version: v1.64
204202
args: --issues-exit-code=1 --timeout 10m
205203
only-new-issues: false

Diff for: .golangci.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ linters-settings:
213213
gocritic:
214214
enable-all: true
215215
disabled-checks:
216-
- typeDefFirst
217216
- paramTypeCombine
218217
- httpNoBody
219218
- ifElseChain
@@ -241,7 +240,7 @@ linters:
241240
#
242241
# DEPRECATED by golangi-lint
243242
#
244-
- exportloopref
243+
- tenv
245244

246245
#
247246
# Redundant
@@ -494,6 +493,11 @@ issues:
494493
text: "argument-limit: .*"
495494

496495
# need some cleanup first: to create db in memory and share the client, not the config
496+
- linters:
497+
- usetesting
498+
path: "(.+)_test.go"
499+
text: "context.Background.*"
500+
497501
- linters:
498502
- usetesting
499503
path: "pkg/apiserver/(.+)_test.go"

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker.io/golang:1.23-alpine3.21 AS build
1+
FROM docker.io/golang:1.24-alpine3.21 AS build
22

33
ARG BUILD_VERSION
44

Diff for: Dockerfile.debian

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker.io/golang:1.23-bookworm AS build
1+
FROM docker.io/golang:1.24-bookworm AS build
22

33
ARG BUILD_VERSION
44

Diff for: azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ stages:
2121
- task: GoTool@0
2222
displayName: "Install Go"
2323
inputs:
24-
version: '1.23.3'
24+
version: '1.24.0'
2525

2626
- pwsh: |
2727
choco install -y make

Diff for: cmd/crowdsec-cli/args/args.go

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package args
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
func MinimumNArgs(n int) cobra.PositionalArgs {
10+
return func(cmd *cobra.Command, args []string) error {
11+
if len(args) < n {
12+
cmd.Help() //nolint:errcheck
13+
return fmt.Errorf("requires at least %d arg(s), only received %d", n, len(args))
14+
}
15+
return nil
16+
}
17+
}
18+
19+
func ExactArgs(n int) cobra.PositionalArgs {
20+
return func(cmd *cobra.Command, args []string) error {
21+
if len(args) != n {
22+
cmd.Help() //nolint:errcheck
23+
return fmt.Errorf("accepts %d arg(s), received %d", n, len(args))
24+
}
25+
return nil
26+
}
27+
}

Diff for: cmd/crowdsec-cli/clialert/alerts.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ import (
2929
"github.com/crowdsecurity/crowdsec/pkg/types"
3030
)
3131

32+
type configGetter func() *csconfig.Config
33+
34+
type cliAlerts struct {
35+
client *apiclient.ApiClient
36+
cfg configGetter
37+
}
38+
3239
func decisionsFromAlert(alert *models.Alert) string {
3340
ret := ""
3441
decMap := make(map[string]int)
@@ -183,13 +190,6 @@ func (cli *cliAlerts) displayOneAlert(alert *models.Alert, withDetail bool) erro
183190
return nil
184191
}
185192

186-
type configGetter func() *csconfig.Config
187-
188-
type cliAlerts struct {
189-
client *apiclient.ApiClient
190-
cfg configGetter
191-
}
192-
193193
func New(getconfig configGetter) *cliAlerts {
194194
return &cliAlerts{
195195
cfg: getconfig,

0 commit comments

Comments
 (0)