mirror of
https://github.com/adulau/git-vuln-finder.git
synced 2024-12-26 10:46:03 +00:00
Fix #17 [main] - set language to unknown
when langdetect cannot detect
the language for some reasons like empty commit message or unknown language. Notes: langdetect exception handler seems to be crap and do not use a Base Exception handler. That's why the catch-all ;-)
This commit is contained in:
parent
5d19d0d0ab
commit
68f273ee54
1 changed files with 6 additions and 4 deletions
|
@ -82,9 +82,11 @@ def summary(
|
|||
else:
|
||||
potential_vulnerabilities[rcommit.hexsha] = {}
|
||||
potential_vulnerabilities[rcommit.hexsha]["message"] = rcommit.message
|
||||
potential_vulnerabilities[rcommit.hexsha]["language"] = langdetect(
|
||||
rcommit.message
|
||||
)
|
||||
try:
|
||||
lang = langdetect(rcommit.message)
|
||||
except:
|
||||
lang = "unknown"
|
||||
potential_vulnerabilities[rcommit.hexsha]["language"] = lang
|
||||
potential_vulnerabilities[rcommit.hexsha]["commit-id"] = rcommit.hexsha
|
||||
potential_vulnerabilities[rcommit.hexsha]["summary"] = rcommit.summary
|
||||
potential_vulnerabilities[rcommit.hexsha]["stats"] = rcommit.stats.total
|
||||
|
@ -128,7 +130,7 @@ def summary_event(
|
|||
commit_state="under-review"
|
||||
):
|
||||
potential_vulnerabilities = {}
|
||||
|
||||
|
||||
cve, cve_found = extract_cve(commit["message"])
|
||||
|
||||
potential_vulnerabilities[commit["sha"]] = {}
|
||||
|
|
Loading…
Reference in a new issue