@@ -287,7 +287,7 @@ func ScanCmd(c *components.Context) error {
287287 SetBaseRepoPath (repoPath ).
288288 SetIncludeVulnerabilities (c .GetBoolFlagValue (flags .Vuln ) || shouldIncludeVulnerabilities (c )).
289289 SetIncludeLicenses (c .GetBoolFlagValue (flags .Licenses )).
290- SetIncludeSbom (c . GetBoolFlagValue ( flags . Sbom )).
290+ SetIncludeSbom (shouldIncludeSbom ( c , format )).
291291 SetFail (c .GetBoolFlagValue (flags .Fail )).
292292 SetPrintExtendedTable (c .GetBoolFlagValue (flags .ExtendedTable )).
293293 SetBypassArchiveLimits (c .GetBoolFlagValue (flags .BypassArchiveLimits )).
@@ -453,16 +453,11 @@ func CreateAuditCmd(c *components.Context) (string, string, *coreConfig.ServerDe
453453 auditCmd .SetScaScanStrategy (scaScanStrategy )
454454 auditCmd .SetViolationGenerator (violationGenerator )
455455 auditCmd .SetUploadCdxResults (uploadResults ).SetRtResultRepository (c .GetStringFlagValue (flags .UploadRtRepoPath ))
456- // Make sure include SBOM is only set if the output format supports it
457- includeSbom := c .GetBoolFlagValue (flags .Sbom )
458- if includeSbom && format != outputFormat .Table && format != outputFormat .CycloneDx {
459- log .Warn (fmt .Sprintf ("The '--%s' flag is only supported with the 'table' or 'cyclonedx' output format. The SBOM will not be included in the output." , flags .Sbom ))
460- }
461456 auditCmd .SetTargetRepoPath (addTrailingSlashToRepoPathIfNeeded (c )).
462457 SetProject (getProject (c )).
463458 SetIncludeVulnerabilities (c .GetBoolFlagValue (flags .Vuln )).
464459 SetIncludeLicenses (c .GetBoolFlagValue (flags .Licenses )).
465- SetIncludeSbom (includeSbom ).
460+ SetIncludeSbom (shouldIncludeSbom ( c , format ) ).
466461 SetFail (c .GetBoolFlagValue (flags .Fail )).
467462 SetPrintExtendedTable (c .GetBoolFlagValue (flags .ExtendedTable )).
468463 SetMinSeverityFilter (minSeverity ).
@@ -709,7 +704,7 @@ func DockerScan(c *components.Context, image string) error {
709704 SetBaseRepoPath (addTrailingSlashToRepoPathIfNeeded (c )).
710705 SetIncludeVulnerabilities (c .GetBoolFlagValue (flags .Vuln ) || shouldIncludeVulnerabilities (c )).
711706 SetIncludeLicenses (c .GetBoolFlagValue (flags .Licenses )).
712- SetIncludeSbom (c . GetBoolFlagValue ( flags . Sbom )).
707+ SetIncludeSbom (shouldIncludeSbom ( c , format )).
713708 SetFail (c .GetBoolFlagValue (flags .Fail )).
714709 SetPrintExtendedTable (c .GetBoolFlagValue (flags .ExtendedTable )).
715710 SetBypassArchiveLimits (c .GetBoolFlagValue (flags .BypassArchiveLimits )).
0 commit comments