|
5 | 5 | import os
|
6 | 6 | import sys
|
7 | 7 |
|
| 8 | +from rich.panel import Panel |
8 | 9 | from vdb.lib import config as config
|
9 | 10 | from vdb.lib import db as dbLib
|
10 | 11 | from vdb.lib.gha import GitHubSource
|
|
23 | 24 | from depscan.lib.bom import create_bom, get_pkg_list
|
24 | 25 | from depscan.lib.config import license_data_dir
|
25 | 26 | from depscan.lib.license import build_license_data, bulk_lookup
|
26 |
| -from depscan.lib.logger import LOG |
| 27 | +from depscan.lib.logger import LOG, console |
27 | 28 |
|
28 | 29 | at_logo = """
|
29 | 30 | ___ _____ _ _
|
@@ -266,18 +267,30 @@ def main():
|
266 | 267 | reports_dir, "license-" + project_type + ".json"
|
267 | 268 | )
|
268 | 269 | analyse_licenses(project_type, licenses_results, license_report_file)
|
269 |
| - if args.risk_audit and project_type in risk_audit_map.keys(): |
270 |
| - LOG.info( |
271 |
| - f"Performing package risk audit for {src_dir} of type {project_type}" |
272 |
| - ) |
273 |
| - LOG.debug(f"No of packages {len(pkg_list)}. This will take a while ...") |
274 |
| - try: |
275 |
| - risk_results = risk_audit(project_type, pkg_list, risk_report_file) |
276 |
| - analyse_pkg_risks(project_type, risk_results, risk_report_file) |
277 |
| - except Exception as e: |
278 |
| - LOG.error("Risk audit was not successful") |
279 |
| - LOG.error(e) |
280 |
| - risk_results = None |
| 270 | + if project_type in risk_audit_map.keys(): |
| 271 | + if args.risk_audit: |
| 272 | + console.print( |
| 273 | + Panel( |
| 274 | + f"Performing OSS Risk Audit for packages from {src_dir}\nNo of packages [bold]{len(pkg_list)}[/bold]. This will take a while ...", |
| 275 | + title="OSS Risk Audit", |
| 276 | + expand=False, |
| 277 | + ) |
| 278 | + ) |
| 279 | + try: |
| 280 | + risk_results = risk_audit(project_type, pkg_list, risk_report_file) |
| 281 | + analyse_pkg_risks(project_type, risk_results, risk_report_file) |
| 282 | + except Exception as e: |
| 283 | + LOG.error("Risk audit was not successful") |
| 284 | + LOG.error(e) |
| 285 | + risk_results = None |
| 286 | + else: |
| 287 | + console.print( |
| 288 | + Panel( |
| 289 | + "Depscan supports OSS Risk audit for this project.\nTo enable set the environment variable [bold]ENABLE_OSS_RISK=true[/bold]", |
| 290 | + title="New Feature", |
| 291 | + expand=False, |
| 292 | + ) |
| 293 | + ) |
281 | 294 | if project_type in type_audit_map.keys():
|
282 | 295 | LOG.info(
|
283 | 296 | "Performing remote audit for {} of type {}".format(
|
|
0 commit comments