Skip to content

Commit b6448af

Browse files
committed
Remove formatter function for importer_name
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
1 parent 478b2d7 commit b6448af

6 files changed

Lines changed: 16 additions & 20 deletions

File tree

insights/charts/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/aboutcode-org/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
110
from functools import partial
211

312
from insights.models import ChartDefinition

insights/charts/importer_panel.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from django.db.models import Q
1616

1717
from insights.models import ImporterInsight
18-
from insights.utils import format_importer_name
1918
from vulnerabilities.models import AdvisoryExploit
2019
from vulnerabilities.models import AdvisoryV2
2120

@@ -128,7 +127,7 @@ def _get_snapshot_data(snapshot: Any, build_columns_fn) -> Dict[str, Any]:
128127

129128
# Individual data for each importer
130129
for importer_insight in all_importers:
131-
formatted_name = format_importer_name(importer_insight.importer)
130+
formatted_name = importer_insight.importer
132131
data[formatted_name] = build_columns_fn([importer_insight])
133132

134133
return data
@@ -144,7 +143,7 @@ def build_importer_package_columns(importers) -> Dict[str, Any]:
144143
advisories_without_ghost_packages = []
145144

146145
for importer_insight in importers:
147-
importer_names.append(format_importer_name(importer_insight.importer))
146+
importer_names.append(importer_insight.importer)
148147
total_advisories.append(importer_insight.total_advisories)
149148
advisories_with_packages.append(importer_insight.advisories_with_packages)
150149
advisories_without_packages.append(
@@ -183,7 +182,7 @@ def build_importer_exploit_columns(importers) -> Dict[str, Any]:
183182
advisories_with_exploitdb = []
184183

185184
for importer_insight in importers:
186-
importer_names.append(format_importer_name(importer_insight.importer))
185+
importer_names.append(importer_insight.importer)
187186
total_advisories.append(importer_insight.total_advisories)
188187
advisories_with_kev.append(importer_insight.advisories_with_kev)
189188
advisories_with_metasploit.append(importer_insight.advisories_with_metasploit)

insights/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class Meta:
9797

9898
@dataclass(frozen=True)
9999
class ChartDefinition:
100-
101100
id: str
102101
title: str
103102
panel: str

insights/utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,3 @@ def get_cwe_label(cwe_id: str) -> str:
1717
return f"CWE-{num} · {name}" if name else f"CWE-{num}"
1818
except KeyError:
1919
return f"CWE-{num}"
20-
21-
22-
def format_importer_name(name: str) -> str:
23-
"""
24-
Format importer internal names into human-readable labels.
25-
e.g., 'pysec_importer_v2' -> 'Pysec Importer'
26-
"""
27-
parts = name.rsplit("_v", 1)
28-
if len(parts) == 2 and parts[1].isdigit():
29-
name = parts[0]
30-
return name.replace("_", " ")

vulnerabilities/improvers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

10-
from insights.insights_snapshot_pipeline import InsightsSnapshotPipeline
10+
from insights import insights_snapshot_pipeline
1111
from vulnerabilities.pipelines.v2_improvers import archive_urls
1212
from vulnerabilities.pipelines.v2_improvers import collect_ssvc_trees
1313
from vulnerabilities.pipelines.v2_improvers import compute_advisory_todo as compute_advisory_todo_v2
@@ -44,6 +44,6 @@
4444
enhance_with_github_poc.GithubPocsImproverPipeline,
4545
mark_unfurl_version_range.MarkUnfurlVersionRangePipeline,
4646
group_advisories_for_packages_v2.GroupAdvisoriesForPackages,
47-
InsightsSnapshotPipeline,
47+
insights_snapshot_pipeline.InsightsSnapshotPipeline,
4848
]
4949
)

vulnerabilities/templates/navbar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{% load utils %}
22

33

4-
<!-- {% if STAGING %}
4+
{% if STAGING %}
55
<div class="notification is-danger has-text-centered is-fixed-top my-0" style="border-radius: 0;">
66
<span class="icon">
77
<i class="fa fa-exclamation-triangle"></i>
88
</span>
99
<strong> Staging Environment:</strong>
1010
Content and features may be unstable or change without notice.
1111
</div>
12-
{% endif %} -->
12+
{% endif %}
1313

1414
<nav class="navbar is-dark border-bottom-radius" role="navigation" aria-label="main navigation"
1515
style="border-radius: 0;">

0 commit comments

Comments
 (0)