Skip to content

Commit

Permalink
📝 Add docstrings to fix-processor-linter-warnings
Browse files Browse the repository at this point in the history
Docstrings generation was requested by @tphakala.

* #412 (comment)

The following files were modified:

* `internal/analysis/processor/execute.go`
* `internal/analysis/processor/processor.go`
  • Loading branch information
coderabbitai[bot] authored Jan 25, 2025
1 parent 9c8b18d commit e1f636f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/analysis/processor/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func sanitizeValue(value interface{}) (string, error) {
return str, nil
}

// getCleanEnvironment returns a minimal set of necessary environment variables
// getCleanEnvironment returns a minimal set of environment variables necessary for safe command execution across different operating systems. It includes essential system paths and optionally adds the SystemRoot variable for Windows systems. The returned slice contains only the required environment variables, helping to maintain a clean and secure execution context.
func getCleanEnvironment() []string {
// Provide only necessary environment variables
env := []string{
Expand All @@ -167,7 +167,7 @@ func getCleanEnvironment() []string {
return env
}

// getNoteValueByName retrieves a value from a Note by field name using reflection
// If the field is not found or cannot be interfaced, it returns nil.
func getNoteValueByName(note *datastore.Note, paramName string) interface{} {
val := reflect.ValueOf(*note)
fieldVal := val.FieldByName(paramName)
Expand Down
4 changes: 2 additions & 2 deletions internal/analysis/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func (p *Processor) pendingDetectionsFlusher() {
}()
}

// Helper function to check if a slice contains a string (case-insensitive)
// It returns true if the item is found in the slice, otherwise false.
func contains(slice []string, item string) bool {
for _, s := range slice {
if strings.EqualFold(s, item) {
Expand Down Expand Up @@ -467,7 +467,7 @@ func (p *Processor) getActionsForItem(detection *Detections) []Action {
return p.getDefaultActions(detection)
}

// Helper function to parse command parameters
// If a parameter is not found in the detection note, its value will be nil.
func parseCommandParams(params []string, detection *Detections) map[string]interface{} {
commandParams := make(map[string]interface{})
for _, param := range params {
Expand Down

0 comments on commit e1f636f

Please sign in to comment.