Skip to content

Commit

Permalink
cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNino committed Sep 4, 2024
1 parent 632a8ac commit 45a7344
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
21 changes: 8 additions & 13 deletions general/summary/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/commandsummary"
"github.com/jfrog/jfrog-cli/utils/cliutils"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -38,6 +37,7 @@ func (ms MarkdownSection) String() string {
return string(ms)
}

// Generates a combined markdown from all sections, and aggregates multiple SARIF files into one.
func FinalizeCommandSummaries(c *cli.Context) error {
if !shouldGenerateSummary() {
return fmt.Errorf("unable to generate the command summary because the output directory is not specified."+
Expand Down Expand Up @@ -160,18 +160,13 @@ func getSectionMarkdownContent(section MarkdownSection) (string, error) {
}

func getSarifFiles() (files []string, err error) {
sarifsDir := getSarifReportsDir()
exists, err := fileutils.IsDirExists(sarifsDir, false)
if err != nil || !exists {
return
}
entries, err := os.ReadDir(sarifsDir)
indexedFiles, err := commandsummary.GetIndexedDataFilesPaths()
if err != nil {
return
}

for _, entry := range entries {
files = append(files, filepath.Join(sarifsDir, entry.Name()))
sarifsMap := indexedFiles[commandsummary.SarifReport]
for i := range sarifsMap {
files = append(files, sarifsMap[i])
}
return
}
Expand Down Expand Up @@ -208,7 +203,7 @@ func generateBuildInfoMarkdown() error {
if err != nil {
return fmt.Errorf("error generating build-info markdown: %w", err)
}
if err = mapScanResults(buildInfoSummary); err != nil {
if err = mapScanResults(); err != nil {
return fmt.Errorf("error mapping scan results: %w", err)
}
return buildInfoSummary.GenerateMarkdown()
Expand All @@ -227,9 +222,9 @@ func generateUploadMarkdown() error {
}

// mapScanResults maps the scan results saved during runtime into scan components.
func mapScanResults(commandSummary *commandsummary.CommandSummary) (err error) {
func mapScanResults() (err error) {
// Gets the saved scan results file paths.
indexedFiles, err := commandSummary.GetIndexedDataFilesPaths()
indexedFiles, err := commandsummary.GetIndexedDataFilesPaths()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20240829171158-7b0f89df2c0c
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/RobiNino/jfrog-cli-core/v2 v2.0.0-20240904105726-775a1614224e

replace github.com/jfrog/jfrog-cli-security => github.com/attiasas/jfrog-cli-security v0.0.0-20240904061406-f368939ce3a0

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/RobiNino/jfrog-cli-core/v2 v2.0.0-20240904105726-775a1614224e h1:DdCEdK/f85CEu7/kC04Oec0tECl6gbKnXpLmrmdILf8=
github.com/RobiNino/jfrog-cli-core/v2 v2.0.0-20240904105726-775a1614224e/go.mod h1:DPO5BfWAeOByahFMMy+PcjmbPlcyoRy7Bf2C5sGKVi0=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
Expand Down Expand Up @@ -943,8 +945,6 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-cli-artifactory v0.1.6 h1:bMfJsrLQJw0dZp4nqUf1xOmtY0rpCatW/I5q88x+fhQ=
github.com/jfrog/jfrog-cli-artifactory v0.1.6/go.mod h1:jbNb22ebtupcjdhrdGq0VBew2vWG6VUK04xxGNDfynE=
github.com/jfrog/jfrog-cli-core/v2 v2.55.6 h1:3tQuEdYgS2q7fkrrSG66OnO0S998FXGaY9BVsxSLst4=
github.com/jfrog/jfrog-cli-core/v2 v2.55.6/go.mod h1:DPO5BfWAeOByahFMMy+PcjmbPlcyoRy7Bf2C5sGKVi0=
github.com/jfrog/jfrog-cli-platform-services v1.3.0 h1:IblSDZFBjL7WLRi37Ni2DmHrXJJ6ysSMxx7t41AvyDA=
github.com/jfrog/jfrog-cli-platform-services v1.3.0/go.mod h1:Ky4SDXuMeaiNP/5zMT1YSzIuXG+cNYYOl8BaEA7Awbc=
github.com/jfrog/jfrog-client-go v1.46.1 h1:ExqOF8ClOG9LO3vbm6jTIwQHHhprbu8lxB2RrM6mMI0=
Expand Down

0 comments on commit 45a7344

Please sign in to comment.