mirror of
https://github.com/hohn/sarif-cli.git
synced 2025-12-16 17:23:03 +01:00
Don't trail the project name with a dash if the subset name is blank
This commit is contained in:
committed by
=Michael Hohn
parent
37eb55abef
commit
3854036fa7
@@ -82,15 +82,19 @@ def joins_for_projects(basetables, external_info):
|
|||||||
"""
|
"""
|
||||||
b = basetables; e = external_info
|
b = basetables; e = external_info
|
||||||
|
|
||||||
extra = ""
|
automationDetails = ""
|
||||||
# if the sarif does have automationDetails
|
# if the sarif does have automationDetails
|
||||||
if "automationDetails" in b.project:
|
if "automationDetails" in b.project:
|
||||||
extra = b.project.automationDetails[0]
|
automationDetails = b.project.automationDetails[0]
|
||||||
# if the sarif does have versionControlProvenance
|
# if the sarif does have versionControlProvenance
|
||||||
if "repositoryUri" in b.project:
|
if "repositoryUri" in b.project:
|
||||||
repoUri = b.project.repositoryUri[0]
|
repoUri = b.project.repositoryUri[0]
|
||||||
project_name = b.project.repositoryUri[0] + "-" + extra
|
if automationDetails == "no-value-for-ad":
|
||||||
e.project_id = hash.hash_unique((repoUri+extra).encode())
|
project_name = b.project.repositoryUri[0]
|
||||||
|
else:
|
||||||
|
project_name = b.project.repositoryUri[0] + "-" + automationDetails
|
||||||
|
|
||||||
|
e.project_id = hash.hash_unique((repoUri+automationDetails).encode())
|
||||||
else:
|
else:
|
||||||
repoUri = "unknown"
|
repoUri = "unknown"
|
||||||
|
|
||||||
@@ -101,7 +105,7 @@ def joins_for_projects(basetables, external_info):
|
|||||||
"repo_url" : repoUri,
|
"repo_url" : repoUri,
|
||||||
"primary_language" : b.project['semmle.sourceLanguage'][0],
|
"primary_language" : b.project['semmle.sourceLanguage'][0],
|
||||||
"languages_analyzed" : ",".join(list(b.project['semmle.sourceLanguage'])),
|
"languages_analyzed" : ",".join(list(b.project['semmle.sourceLanguage'])),
|
||||||
"automationDetails" : extra,
|
"automationDetails" : automationDetails,
|
||||||
}, index=[0])
|
}, index=[0])
|
||||||
|
|
||||||
# Force all column types to ensure appropriate formatting
|
# Force all column types to ensure appropriate formatting
|
||||||
|
|||||||
@@ -253,7 +253,8 @@ def fillsig_dict(args, elem, context):
|
|||||||
# simple sequence tests.
|
# simple sequence tests.
|
||||||
|
|
||||||
if 'results' in elem.keys() and not 'automationDetails' in elem.keys():
|
if 'results' in elem.keys() and not 'automationDetails' in elem.keys():
|
||||||
#want this to be blank if not present- ie no submodule info added/no sarif-category used
|
# Want this to be flagged if not present- ie no submodule info added/no
|
||||||
|
# sarif-category used
|
||||||
full_elem['automationDetails'] = {'id' : "no-value-for-ad"}
|
full_elem['automationDetails'] = {'id' : "no-value-for-ad"}
|
||||||
|
|
||||||
if {'locations', 'message', 'partialFingerprints', 'ruleId',
|
if {'locations', 'message', 'partialFingerprints', 'ruleId',
|
||||||
|
|||||||
Reference in New Issue
Block a user