Skip to content

Commit 25b8134

Browse files
committed
[PLUTO-1431] Go/gosec running
1 parent 7b8ad7b commit 25b8134

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

cmd/analyze.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"codacy/cli-v2/domain"
66
"codacy/cli-v2/plugins"
77
"codacy/cli-v2/tools"
8+
gosecTool "codacy/cli-v2/tools/gosec"
89
"codacy/cli-v2/tools/lizard"
910
"encoding/json"
1011
"fmt"
@@ -412,6 +413,16 @@ func runEnigmaAnalysis(workDirectory string, pathsToCheck []string, outputFile s
412413
return tools.RunEnigma(workDirectory, enigma.InstallDir, enigma.Binaries["codacy-enigma-cli"], pathsToCheck, outputFile, outputFormat)
413414
}
414415

416+
func runGosecAnalysis(workDirectory string, pathsToCheck []string, outputFile string, outputFormat string) error {
417+
gosec := config.Config.Tools()["gosec"]
418+
if gosec == nil {
419+
log.Fatal("Gosec tool configuration not found")
420+
}
421+
gosecBinary := gosec.Binaries["gosec"]
422+
423+
return gosecTool.RunGosec(workDirectory, gosecBinary, pathsToCheck, outputFile, outputFormat)
424+
}
425+
415426
var analyzeCmd = &cobra.Command{
416427
Use: "analyze",
417428
Short: "Runs all configured linters.",
@@ -522,6 +533,8 @@ func runTool(workDirectory string, toolName string, args []string, outputFile st
522533
return runLizardAnalysis(workDirectory, args, outputFile, outputFormat)
523534
case "codacy-enigma-cli":
524535
return runEnigmaAnalysis(workDirectory, args, outputFile, outputFormat)
536+
case "gosec":
537+
return runGosecAnalysis(workDirectory, args, outputFile, outputFormat)
525538
default:
526539
return fmt.Errorf("unsupported tool: %s", toolName)
527540
}

plugins/runtimes/go/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: go
22
# Go Programming Language Runtime
33
# Provides the Go compiler and tools for building and running Go programs.
44
description: Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
5-
default_version: 1.22.3
5+
default_version: 1.24.1
66
download:
77
url_template: "https://go.dev/dl/go{{.Version}}.{{.OS}}-{{.Arch}}.tar.gz"
88
file_name_template: "go{{.Version}}.{{.OS}}-{{.Arch}}.tar.gz"

plugins/tools/gosec/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: gosec
22
# Gosec - Golang Security Checker
33
# Inspects source code for security problems by scanning the Go AST.
44
description: Gosec inspects Go source code for security problems by scanning the Go AST.
5-
default_version: 2.15.0
5+
default_version: 2.22.4
66
runtime: go
77
runtime_binaries:
88
package_manager: go

0 commit comments

Comments
 (0)