Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jun 7, 2024
1 parent b94cf0d commit 4c542dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions pkg/acquisition/modules/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func (s *S3Source) newS3Client() error {
}

sess, err := session.NewSessionWithOptions(options)

if err != nil {
return fmt.Errorf("failed to create aws session: %w", err)
}
Expand All @@ -146,7 +145,7 @@ func (s *S3Source) newS3Client() error {

s.s3Client = s3.New(sess, config)
if s.s3Client == nil {
return fmt.Errorf("failed to create S3 client")
return errors.New("failed to create S3 client")

Check warning on line 148 in pkg/acquisition/modules/s3/s3.go

View check run for this annotation

Codecov / codecov/patch

pkg/acquisition/modules/s3/s3.go#L148

Added line #L148 was not covered by tests
}

return nil
Expand All @@ -167,7 +166,7 @@ func (s *S3Source) newSQSClient() error {
}

if sess == nil {
return fmt.Errorf("failed to create aws session")
return errors.New("failed to create aws session")

Check warning on line 169 in pkg/acquisition/modules/s3/s3.go

View check run for this annotation

Codecov / codecov/patch

pkg/acquisition/modules/s3/s3.go#L169

Added line #L169 was not covered by tests
}
config := aws.NewConfig()
if s.Config.AwsRegion != "" {
Expand All @@ -178,7 +177,7 @@ func (s *S3Source) newSQSClient() error {
}
s.sqsClient = sqs.New(sess, config)
if s.sqsClient == nil {
return fmt.Errorf("failed to create SQS client")
return errors.New("failed to create SQS client")

Check warning on line 180 in pkg/acquisition/modules/s3/s3.go

View check run for this annotation

Codecov / codecov/patch

pkg/acquisition/modules/s3/s3.go#L180

Added line #L180 was not covered by tests
}
return nil
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/appsec/appsec_rule/modsecurity.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package appsec_rule

import (
"errors"
"fmt"
"hash/fnv"
"strings"
Expand Down Expand Up @@ -67,9 +68,7 @@ var bodyTypeMatch map[string]string = map[string]string{
}

func (m *ModsecurityRule) Build(rule *CustomRule, appsecRuleName string) (string, []uint32, error) {

rules, err := m.buildRules(rule, appsecRuleName, false, 0, 0)

if err != nil {
return "", nil, err
}
Expand Down Expand Up @@ -99,7 +98,7 @@ func (m *ModsecurityRule) buildRules(rule *CustomRule, appsecRuleName string, an
ret := make([]string, 0)

if len(rule.And) != 0 && len(rule.Or) != 0 {
return nil, fmt.Errorf("cannot have both 'and' and 'or' in the same rule")
return nil, errors.New("cannot have both 'and' and 'or' in the same rule")

Check warning on line 101 in pkg/appsec/appsec_rule/modsecurity.go

View check run for this annotation

Codecov / codecov/patch

pkg/appsec/appsec_rule/modsecurity.go#L101

Added line #L101 was not covered by tests
}

if rule.And != nil {
Expand Down

0 comments on commit 4c542dd

Please sign in to comment.