diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 572757b7ea..aa3b49c809 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -1010,13 +1010,12 @@ def dump_html_pkg(f, pkg): if pkg.latest_version['version'] is None: latest_version_text = "Found, but no version" else: - latest_version_text = "%s" % \ - (pkg.latest_version['id'], str(pkg.latest_version['version'])) + latest_version_text = f"""{str(pkg.latest_version['version'])}""" latest_version_text += "
" if pkg.latest_version['status'] == RM_API_STATUS_FOUND_BY_DISTRO: - latest_version_text += "found by distro" + latest_version_text += f'found by distro' else: latest_version_text += "found by guess" @@ -1041,10 +1040,10 @@ def dump_html_pkg(f, pkg): div_class.append("missing_url") if pkg.status['url'][0] == "error": div_class.append("invalid_url") - url_str = "%s" % (pkg.url, pkg.status['url'][1]) + url_str = f"""{pkg.status['url'][1]}""" else: div_class.append("good_url") - url_str = "Link" % pkg.url + url_str = f'Link' f.write(f'
{url_str}
\n') # CVEs @@ -1068,11 +1067,11 @@ def dump_html_pkg(f, pkg): class="see-more centered cve_ignored">see all ({cve_total}) ▾\n') if pkg.is_status_error("cve"): for cve in pkg.cves: - f.write(" %s
\n" % (cve, cve)) + f.write(f' {cve}
\n') for cve in pkg.unsure_cves: - f.write(" %s (unsure)
\n" % (cve, cve)) + f.write(f' {cve} (unsure)
\n') elif pkg.is_status_na("cve"): - f.write(" %s" % pkg.status['cve'][1]) + f.write(f""" {pkg.status['cve'][1]}""") else: f.write(" N/A\n") f.write(" \n") @@ -1085,7 +1084,7 @@ def dump_html_pkg(f, pkg): div_class.append("cve_ignored") f.write(f'
\n') for ignored_cve in pkg.ignored_cves: - f.write(" %s
\n" % (ignored_cve, ignored_cve)) + f.write(f' {ignored_cve}
\n') f.write("
\n") # CPE ID @@ -1108,11 +1107,9 @@ def dump_html_pkg(f, pkg): if not pkg.is_status_ok("cpe"): if pkg.is_actual_package and pkg.current_version: if pkg.cpeid: - f.write("
%s (Search)\n" % # noqa: E501 - (pkg.status['cpe'][1], ":".join(pkg.cpeid.split(":")[0:5]))) + f.write(f"""
{pkg.status['cpe'][1]} (Search)\n""") # noqa: E501 else: - f.write(" %s (Search)\n" % # noqa: E501 - (pkg.status['cpe'][1], pkg.name)) + f.write(f""" {pkg.status['cpe'][1]} (Search)\n""") # noqa: E501 else: f.write(" %s\n" % pkg.status['cpe'][1]) @@ -1155,49 +1152,49 @@ def dump_html_all_pkgs(f, packages): def dump_html_stats(f, stats): - f.write("\n") - f.write("
\n") + f.write('\n') + f.write('
\n') infras = [infra[6:] for infra in stats.keys() if infra.startswith("infra-")] for infra in infras: - f.write("
Packages using the %s infrastructure
%s
\n" % + f.write('
Packages using the %s infrastructure
%s
\n' % (infra, stats["infra-%s" % infra])) - f.write("
Packages having license information
%s
\n" % + f.write('
Packages having license information
%s
\n' % stats["license"]) - f.write("
Packages not having license information
%s
\n" % + f.write('
Packages not having license information
%s
\n' % stats["no-license"]) - f.write("
Packages having license files information
%s
\n" % + f.write('
Packages having license files information
%s
\n' % stats["license-files"]) - f.write("
Packages not having license files information
%s
\n" % + f.write('
Packages not having license files information
%s
\n' % stats["no-license-files"]) - f.write("
Packages having a hash file
%s
\n" % + f.write('
Packages having a hash file
%s
\n' % stats["hash"]) - f.write("
Packages not having a hash file
%s
\n" % + f.write('
Packages not having a hash file
%s
\n' % stats["no-hash"]) - f.write("
Total number of patches
%s
\n" % + f.write('
Total number of patches
%s
\n' % stats["patches"]) - f.write("
Packages having a mapping on release-monitoring.org
%s
\n" % + f.write('
Packages having a mapping on release-monitoring.org
%s
\n' % stats["rmo-mapping"]) - f.write("
Packages lacking a mapping on release-monitoring.org
%s
\n" % + f.write('
Packages lacking a mapping on release-monitoring.org
%s
\n' % stats["rmo-no-mapping"]) - f.write("
Packages that are up-to-date
%s
\n" % + f.write('
Packages that are up-to-date
%s
\n' % stats["version-uptodate"]) - f.write("
Packages that are not up-to-date
%s
\n" % + f.write('
Packages that are not up-to-date
%s
\n' % stats["version-not-uptodate"]) - f.write("
Packages with no known upstream version
%s
\n" % + f.write('
Packages with no known upstream version
%s
\n' % stats["version-unknown"]) - f.write("
Packages affected by CVEs
%s
\n" % + f.write('
Packages affected by CVEs
%s
\n' % stats["pkg-cves"]) - f.write("
Total number of CVEs affecting all packages
%s
\n" % + f.write('
Total number of CVEs affecting all packages
%s
\n' % stats["total-cves"]) - f.write("
Packages affected by unsure CVEs
%s
\n" % + f.write('
Packages affected by unsure CVEs
%s
\n' % stats["pkg-unsure-cves"]) - f.write("
Total number of unsure CVEs affecting all packages
%s
\n" % + f.write('
Total number of unsure CVEs affecting all packages
%s
\n' % stats["total-unsure-cves"]) - f.write("
Packages with CPE ID
%s
\n" % + f.write('
Packages with CPE ID
%s
\n' % stats["cpe-id"]) - f.write("
Packages without CPE ID
%s
\n" % + f.write('
Packages without CPE ID
%s
\n' % stats["no-cpe-id"]) - f.write("
\n") + f.write('
\n') def dump_html_gen_info(f, date, commit):