Skip to content

Commit 7c97244

Browse files
committed
Add paths in extra data only if they are not empty
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 88ee574 commit 7c97244

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

scanpipe/pipes/d2d.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,18 +1854,26 @@ def map_elfs(project, logger=None):
18541854
def get_elf_file_dwarf_paths(location):
18551855
"""Retrieve dwarf paths for ELF files."""
18561856
paths = get_dwarf_paths(location)
1857-
return {
1858-
"dwarf_compiled_paths": paths.get("compiled_paths") or [],
1859-
"dwarf_included_paths": paths.get("included_paths") or [],
1860-
}
1857+
compiled_paths = paths.get("compiled_paths") or []
1858+
included_paths = (paths.get("included_paths") or [],)
1859+
dwarf_paths = {}
1860+
if compiled_paths:
1861+
dwarf_paths["dwarf_compiled_paths"] = compiled_paths
1862+
if included_paths:
1863+
dwarf_paths["dwarf_included_paths"] = included_paths
1864+
return dwarf_paths
18611865

18621866

18631867
def get_go_file_paths(location):
18641868
"""Retrieve Go file paths."""
18651869
go_symbols = (
18661870
collect_and_parse_symbols(location, check_type=False).get("go_symbols") or {}
18671871
)
1868-
return {"go_file_paths": go_symbols.get("file_paths") or []}
1872+
file_paths = {}
1873+
go_file_paths = go_symbols.get("file_paths") or []
1874+
if go_file_paths:
1875+
file_paths["go_file_paths"] = go_file_paths
1876+
return file_paths
18691877

18701878

18711879
def map_go_paths(project, logger=None):

0 commit comments

Comments
 (0)