diff --git a/internal/output/__snapshots__/vertical_test.snap b/internal/output/__snapshots__/vertical_test.snap index 45a97e9c2cd..a65e165296b 100755 --- a/internal/output/__snapshots__/vertical_test.snap +++ b/internal/output/__snapshots__/vertical_test.snap @@ -18,21 +18,24 @@ path/to/my/third/lockfile: found 2 packages with issues path/to/my/first/lockfile: found 1 package with issues no known vulnerabilities found - mine1@1.2.3 is using an incompatible license: MIT + license violations found: + mine1@1.2.3 (MIT) 1 license violation found in path/to/my/first/lockfile path/to/my/second/lockfile: found 2 packages with issues no known vulnerabilities found - mine2@3.2.5 is using an incompatible license: Apache-2.0 + license violations found: + mine2@3.2.5 (Apache-2.0) 1 license violation found in path/to/my/second/lockfile path/to/my/third/lockfile: found 2 packages with issues no known vulnerabilities found - mine1@1.2.3 is using an incompatible license: MIT + license violations found: + mine1@1.2.3 (MIT) 1 license violation found in path/to/my/third/lockfile @@ -75,7 +78,8 @@ path/to/my/first/lockfile: found 1 package with issues path/to/my/first/lockfile: found 1 package with issues no known vulnerabilities found - mine1@1.2.3 is using incompatible licenses: MIT, Apache-2.0 + license violations found: + mine1@1.2.3 (MIT, Apache-2.0) 2 license violations found in path/to/my/first/lockfile @@ -85,7 +89,8 @@ path/to/my/first/lockfile: found 1 package with issues path/to/my/first/lockfile: found 1 package with issues no known vulnerabilities found - mine1@1.2.3 is using an incompatible license: MIT + license violations found: + mine1@1.2.3 (MIT) 1 license violation found in path/to/my/first/lockfile @@ -95,7 +100,8 @@ path/to/my/first/lockfile: found 1 package with issues path/to/my/first/lockfile: found 1 package with issues no known vulnerabilities found - mine1@1.2.3 is using an incompatible license: MIT + license violations found: + mine1@1.2.3 (MIT) 1 license violation found in path/to/my/first/lockfile @@ -113,7 +119,8 @@ path/to/my/first/lockfile: found 1 package with issues 1 known vulnerability found in path/to/my/first/lockfile - mine1@1.2.3 is using an incompatible license: MIT + license violations found: + mine1@1.2.3 (MIT) 1 license violation found in path/to/my/first/lockfile @@ -132,8 +139,9 @@ path/to/my/third/lockfile: found 2 packages with issues 1 known vulnerability found in path/to/my/third/lockfile - mine1@1.3.5 is using an incompatible license: MIT - mine1@1.2.3 is using an incompatible license: Apache-2.0 + license violations found: + mine1@1.3.5 (MIT) + mine1@1.2.3 (Apache-2.0) 2 license violations found in path/to/my/third/lockfile @@ -147,7 +155,8 @@ path/to/my/first/lockfile: found 1 package with issues 1 known vulnerability found in path/to/my/first/lockfile - mine1@1.2.3 is using an incompatible license: MIT + license violations found: + mine1@1.2.3 (MIT) 1 license violation found in path/to/my/first/lockfile @@ -165,7 +174,8 @@ path/to/my/first/lockfile: found 1 package with issues path/to/my/second/lockfile: found 1 package with issues no known vulnerabilities found - mine2@5.9.0 is using an incompatible license: MIT + license violations found: + mine2@5.9.0 (MIT) 1 license violation found in path/to/my/second/lockfile diff --git a/internal/output/vertical.go b/internal/output/vertical.go index c73dc301c7d..7e6604ce2f6 100644 --- a/internal/output/vertical.go +++ b/internal/output/vertical.go @@ -19,7 +19,7 @@ func PrintVerticalResults(vulnResult *models.VulnerabilityResults, outputWriter printVerticalLicenseViolations(result, outputWriter) } - if i < len(vulnResult.Results) - 1 { + if i < len(vulnResult.Results)-1 { fmt.Fprintln(outputWriter) } } @@ -93,7 +93,7 @@ func printVerticalLicenseViolations(result models.PackageSource, out io.Writer) return } - fmt.Fprintln(out) + fmt.Fprintf(out, "\n %s\n", color.RedString("license violations found:")) for _, pkg := range result.Packages { if len(pkg.LicenseViolations) == 0 { @@ -106,12 +106,8 @@ func printVerticalLicenseViolations(result models.PackageSource, out io.Writer) } fmt.Fprintf(out, - " %s %s %s\n", + " %s (%s)\n", color.YellowString("%s@%s", pkg.Package.Name, pkg.Package.Version), - color.RedString(Form(len(violations), - "is using an incompatible license:", - "is using incompatible licenses:", - )), color.CyanString(strings.Join(violations, ", ")), ) }