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

Typos #3084

Merged
merged 4 commits into from
Jun 13, 2024
Merged

Typos #3084

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
2 changes: 1 addition & 1 deletion cmd/crowdsec-cli/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func (cli *cliSupport) writeToZip(zipWriter *zip.Writer, filename string, mtime
}
}

// writeToZip adds a file to the zip archive, from a file, and retains the mtime
// writeFileToZip adds a file to the zip archive, from a file, and retains the mtime
func (cli *cliSupport) writeFileToZip(zw *zip.Writer, filename string, fromFile string) {
mtime := time.Now()

Expand Down
2 changes: 1 addition & 1 deletion cmd/crowdsec/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/* parse the log using magic */
parsed, err := parser.Parse(parserCTX, event, nodes)
if err != nil {
log.Errorf("failed parsing : %v\n", err)
log.Errorf("failed parsing: %v", err)

Check warning on line 40 in cmd/crowdsec/parse.go

View check run for this annotation

Codecov / codecov/patch

cmd/crowdsec/parse.go#L40

Added line #L40 was not covered by tests
}
elapsed := time.Since(startParsing)
globalParsingHistogram.With(prometheus.Labels{"source": event.Line.Src, "type": event.Line.Module}).Observe(elapsed.Seconds())
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiserver/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func TestWithWrongFlushConfig(t *testing.T) {
config.API.Server.DbConfig.Flush.MaxItems = &maxItems
apiServer, err := NewServer(config.API.Server)

cstest.RequireErrorContains(t, err, "max_items can't be zero or negative number")
cstest.RequireErrorContains(t, err, "max_items can't be zero or negative")
assert.Nil(t, apiServer)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/database/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (c *Client) StartFlushScheduler(config *csconfig.FlushDBCfg) (*gocron.Sched
maxAge := ""

if config.MaxItems != nil && *config.MaxItems <= 0 {
return nil, errors.New("max_items can't be zero or negative number")
return nil, errors.New("max_items can't be zero or negative")
}

if config.MaxItems != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/exprhelpers/crowdsec_cti_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func smokeHandler(req *http.Request) *http.Response {
}
}

func TestNillClient(t *testing.T) {
func TestNilClient(t *testing.T) {
defer ShutdownCrowdsecCTI()

if err := InitCrowdsecCTI(ptr.Of(""), nil, nil, nil); !errors.Is(err, cticlient.ErrDisabled) {
Expand Down
10 changes: 5 additions & 5 deletions pkg/exprhelpers/debugger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestBaseDbg(t *testing.T) {
"base_string": "hello world",
"base_int": 42,
"base_float": 42.42,
"nillvar": &teststruct{},
"nilvar": &teststruct{},
"base_struct": struct {
Foo string
Bar int
Expand All @@ -79,8 +79,8 @@ func TestBaseDbg(t *testing.T) {
//Missing multi parametes function
tests := []ExprDbgTest{
{
Name: "nill deref",
Expr: "Upper('1') == '1' && nillvar.Foo == '42'",
Name: "nil deref",
Expr: "Upper('1') == '1' && nilvar.Foo == '42'",
Env: defaultEnv,
ExpectedFailRuntime: true,
ExpectedOutputs: []OpOutput{
Expand Down Expand Up @@ -307,8 +307,8 @@ func TestBaseDbg(t *testing.T) {
t.Fatalf("test %s : unexpected compile error : %s", test.Name, err)
}
}
if test.Name == "nill deref" {
test.Env["nillvar"] = nil
if test.Name == "nil deref" {
test.Env["nilvar"] = nil
}
outdbg, ret, err := RunWithDebug(prog, test.Env, logger)
if test.ExpectedFailRuntime {
Expand Down
4 changes: 2 additions & 2 deletions pkg/parser/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

iter := reflect.ValueOf(evt).Elem()
if (iter == reflect.Value{}) || iter.IsZero() {
log.Tracef("event is nill")
//event is nill
log.Tracef("event is nil")
//event is nil

Check warning on line 46 in pkg/parser/runtime.go

View check run for this annotation

Codecov / codecov/patch

pkg/parser/runtime.go#L45-L46

Added lines #L45 - L46 were not covered by tests
return false
}
for _, f := range strings.Split(target, ".") {
Expand Down
Loading