Skip to content

Commit

Permalink
Typos (#3084)
Browse files Browse the repository at this point in the history
* comment fix

* redundancy

* typo nill -> nil

* remove extra newline from log
  • Loading branch information
mmetc authored Jun 13, 2024
1 parent 4e09ae2 commit a529e66
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
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 @@ func runParse(input chan types.Event, output chan types.Event, parserCTX parser.
/* 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)
}
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 @@ func SetTargetByName(target string, value string, evt *types.Event) bool {

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
return false
}
for _, f := range strings.Split(target, ".") {
Expand Down

0 comments on commit a529e66

Please sign in to comment.