mirror of
https://github.com/adulau/git-vuln-finder.git
synced 2024-11-23 02:27:11 +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
|
||||
|
|
Loading…
Reference in a new issue