@@ -886,7 +886,7 @@ function expandField(fieldId){
<body>
-<a href=\"#results\">Results</a><br/>
+<a href="#results">Results</a><br/>
""" # noqa - tabs and spaces
@@ -920,8 +920,8 @@ def boolean_str(b):
def dump_html_pkg(f, pkg):
pkg_css_class = pkg.path.replace("/", "_")[:-3]
- f.write(f'<div id=\"package__{pkg_css_class}\" \
- class=\"package data _{pkg_css_class}\">{pkg.path}</div>\n')
+ f.write(f'<div id="package__{pkg_css_class}" \
+ class="package data _{pkg_css_class}">{pkg.path}</div>\n')
# Patch count
data_field_id = f'patch_count__{pkg_css_class}'
div_class = ["centered patch_count data"]
@@ -932,8 +932,8 @@ def dump_html_pkg(f, pkg):
div_class.append("somepatches")
else:
div_class.append("lotsofpatches")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)} \
- \">{str(pkg.patch_count)}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)} \
+ ">{str(pkg.patch_count)}</div>\n')
# Infrastructure
data_field_id = f'infrastructure__{pkg_css_class}'
@@ -944,8 +944,8 @@ def dump_html_pkg(f, pkg):
div_class.append("wrong")
else:
div_class.append("correct")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)} \
- \">{infra_str(pkg.infras)}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)} \
+ ">{infra_str(pkg.infras)}</div>\n')
# License
data_field_id = f'license__{pkg_css_class}'
@@ -955,8 +955,8 @@ def dump_html_pkg(f, pkg):
div_class.append("correct")
else:
div_class.append("wrong")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)} \
- \">{boolean_str(pkg.is_status_ok("license"))}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)} \
+ ">{boolean_str(pkg.is_status_ok("license"))}</div>\n')
# License files
data_field_id = f'license_files__{pkg_css_class}'
@@ -966,8 +966,8 @@ def dump_html_pkg(f, pkg):
div_class.append("correct")
else:
div_class.append("wrong")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)} \
- \">{boolean_str(pkg.is_status_ok("license-files"))}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)} \
+ ">{boolean_str(pkg.is_status_ok("license-files"))}</div>\n')
# Hash
data_field_id = f'hash_file__{pkg_css_class}'
@@ -977,8 +977,8 @@ def dump_html_pkg(f, pkg):
div_class.append("correct")
else:
div_class.append("wrong")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)} \
- \">{boolean_str(pkg.is_status_ok("hash"))}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)} \
+ ">{boolean_str(pkg.is_status_ok("hash"))}</div>\n')
# Current version
data_field_id = f'current_version__{pkg_css_class}'
@@ -986,8 +986,8 @@ def dump_html_pkg(f, pkg):
current_version = pkg.current_version[:20] + "..."
else:
current_version = pkg.current_version
- f.write(f' <div id=\"{data_field_id}\" \
- class=\"centered current_version data _{pkg_css_class}\">{current_version}</div>\n')
+ f.write(f' <div id="{data_field_id}" \
+ class="centered current_version data _{pkg_css_class}">{current_version}</div>\n')
# Latest version
data_field_id = f'latest_version__{pkg_css_class}'
@@ -1020,7 +1020,7 @@ def dump_html_pkg(f, pkg):
else:
latest_version_text += "found by guess"
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{latest_version_text}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">{latest_version_text}</div>\n')
# Warnings
data_field_id = f'warnings__{pkg_css_class}'
@@ -1030,7 +1030,7 @@ def dump_html_pkg(f, pkg):
div_class.append("correct")
else:
div_class.append("wrong")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{pkg.warnings}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">{pkg.warnings}</div>\n')
# URL status
data_field_id = f'upstream_url__{pkg_css_class}'
@@ -1045,7 +1045,7 @@ def dump_html_pkg(f, pkg):
else:
div_class.append("good_url")
url_str = "<a href=\"%s\">Link</a>" % pkg.url
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{url_str}</div>\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">{url_str}</div>\n')
# CVEs
data_field_id = f'cves__{pkg_css_class}'
@@ -1061,11 +1061,11 @@ def dump_html_pkg(f, pkg):
div_class.append("cve-ok")
else:
div_class.append("cve-unknown")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">\n')
if len(pkg.cves) > 10:
cve_total = len(pkg.cves) + 1
- f.write(f' <div onclick=\"expandField(\'{data_field_id}\')\" \
- class=\"see-more centered cve_ignored\">see all ({cve_total}) ▾</div>\n')
+ f.write(f' <div onclick="expandField(\'{data_field_id}\')" \
+ class="see-more centered cve_ignored">see all ({cve_total}) ▾</div>\n')
if pkg.is_status_error("cve"):
for cve in pkg.cves:
f.write(" <a href=\"https://security-tracker.debian.org/tracker/%s\">%s</a><br/>\n" % (cve, cve))
@@ -1083,7 +1083,7 @@ def dump_html_pkg(f, pkg):
div_class.append(f'_{pkg_css_class}')
if pkg.ignored_cves:
div_class.append("cve_ignored")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">\n')
for ignored_cve in pkg.ignored_cves:
f.write(" <a href=\"https://security-tracker.debian.org/tracker/%s\">%s</a><br/>\n" % (ignored_cve, ignored_cve))
f.write(" </div>\n")
@@ -1100,7 +1100,7 @@ def dump_html_pkg(f, pkg):
div_class.append("cpe-ok")
else:
div_class.append("cpe-unknown")
- f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">\n')
+ f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">\n')
if pkg.cpeid:
cpeid_begin = ":".join(pkg.cpeid.split(":")[0:4]) + ":"
cpeid_formatted = pkg.cpeid.replace(cpeid_begin, cpeid_begin + "<wbr>")
@@ -1121,33 +1121,33 @@ def dump_html_pkg(f, pkg):
def dump_html_all_pkgs(f, packages):
f.write("""
-<div id=\"package-grid\">
-<div style="grid-column: 1;" onclick="sortGrid(this.id)" id=\"package\"
- class=\"package data label\"><span>Package</span><span></span></div>
-<div style="grid-column: 2;" onclick="sortGrid(this.id)" id=\"patch_count\"
- class=\"centered patch_count data label\"><span>Patch count</span><span></span></div>
-<div style="grid-column: 3;" onclick="sortGrid(this.id)" id=\"infrastructure\"
- class=\"centered infrastructure data label\">Infrastructure<span></span></div>
-<div style="grid-column: 4;" onclick="sortGrid(this.id)" id=\"license\"
- class=\"centered license data label\"><span>License</span><span></span></div>
-<div style="grid-column: 5;" onclick="sortGrid(this.id)" id=\"license_files\"
- class=\"centered license_files data label\"><span>License files</span><span></span></div>
-<div style="grid-column: 6;" onclick="sortGrid(this.id)" id=\"hash_file\"
- class=\"centered hash_file data label\"><span>Hash file</span><span></span></div>
-<div style="grid-column: 7;" onclick="sortGrid(this.id)" id=\"current_version\"
- class=\"centered current_version data label\"><span>Current version</span><span></span></div>
-<div style="grid-column: 8;" onclick="sortGrid(this.id)" id=\"latest_version\"
- class=\"centered latest_version data label\"><span>Latest version</span><span></span></div>
-<div style="grid-column: 9;" onclick="sortGrid(this.id)" id=\"warnings\"
- class=\"centered warnings data label\"><span>Warnings</span><span></span></div>
-<div style="grid-column: 10;" onclick="sortGrid(this.id)" id=\"upstream_url\"
- class=\"centered upstream_url data label\"><span>Upstream URL</span><span></span></div>
-<div style="grid-column: 11;" onclick="sortGrid(this.id)" id=\"cves\"
- class=\"centered cves data label\"><span>CVEs</span><span></span></div>
-<div style="grid-column: 12;" onclick="sortGrid(this.id)" id=\"ignored_cves\"
- class=\"centered ignored_cves data label\"><span>CVEs Ignored</span><span></span></div>
-<div style="grid-column: 13;" onclick="sortGrid(this.id)" id=\"cpe_id\"
- class=\"centered cpe_id data label\"><span>CPE ID</span><span></span></div>
+<div id="package-grid">
+<div style="grid-column: 1;" onclick="sortGrid(this.id)" id="package"
+ class="package data label"><span>Package</span><span></span></div>
+<div style="grid-column: 2;" onclick="sortGrid(this.id)" id="patch_count"
+ class="centered patch_count data label"><span>Patch count</span><span></span></div>
+<div style="grid-column: 3;" onclick="sortGrid(this.id)" id="infrastructure"
+ class="centered infrastructure data label">Infrastructure<span></span></div>
+<div style="grid-column: 4;" onclick="sortGrid(this.id)" id="license"
+ class="centered license data label"><span>License</span><span></span></div>
+<div style="grid-column: 5;" onclick="sortGrid(this.id)" id="license_files"
+ class="centered license_files data label"><span>License files</span><span></span></div>
+<div style="grid-column: 6;" onclick="sortGrid(this.id)" id="hash_file"
+ class="centered hash_file data label"><span>Hash file</span><span></span></div>
+<div style="grid-column: 7;" onclick="sortGrid(this.id)" id="current_version"
+ class="centered current_version data label"><span>Current version</span><span></span></div>
+<div style="grid-column: 8;" onclick="sortGrid(this.id)" id="latest_version"
+ class="centered latest_version data label"><span>Latest version</span><span></span></div>
+<div style="grid-column: 9;" onclick="sortGrid(this.id)" id="warnings"
+ class="centered warnings data label"><span>Warnings</span><span></span></div>
+<div style="grid-column: 10;" onclick="sortGrid(this.id)" id="upstream_url"
+ class="centered upstream_url data label"><span>Upstream URL</span><span></span></div>
+<div style="grid-column: 11;" onclick="sortGrid(this.id)" id="cves"
+ class="centered cves data label"><span>CVEs</span><span></span></div>
+<div style="grid-column: 12;" onclick="sortGrid(this.id)" id="ignored_cves"
+ class="centered ignored_cves data label"><span>CVEs Ignored</span><span></span></div>
+<div style="grid-column: 13;" onclick="sortGrid(this.id)" id="cpe_id"
+ class="centered cpe_id data label"><span>CPE ID</span><span></span></div>
""")
for pkg in sorted(packages):
dump_html_pkg(f, pkg)
Within single-quoted f-strings, and within triple double quoted strings, escaping all the double quotes is completely useless and makes the code more difficult to read. Get rid of all this useless escaping. The renderer HTML is exactly identical before/after this commit. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> --- support/scripts/pkg-stats | 100 +++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 50 deletions(-)