github-pr-stats icon indicating copy to clipboard operation
github-pr-stats copied to clipboard

ZeroDivisionError: division by zero on stats['count']

Open djalal opened this issue 9 years ago • 4 comments

This is only solved if I enable "issues" on the repo

$ github-pr-stats --basic

Traceback (most recent call last): File "/usr/local/bin/github-pr-stats", line 151, in bucketSize=arguments['--bucketSize'], plugins=arguments['--plugins'], url=githubUrl) File "/Library/Python/2.7/site-packages/github_pr_stats/github_pr_stats.py", line 166, in analyze percentageMerged = 100 * (stats['merged'] / stats['count']) ZeroDivisionError: division by zero

djalal avatar Dec 18 '15 11:12 djalal

I have the same issue Traceback (most recent call last): File "/usr/local/bin/github-pr-stats", line 151, in bucketSize=arguments['--bucketSize'], plugins=arguments['--plugins'], url=githubUrl) File "/Library/Python/2.7/site-packages/github_pr_stats/github_pr_stats.py", line 166, in analyze percentageMerged = 100 * (stats['merged'] / stats['count']) ZeroDivisionError: division by zero

Did you find any solution plz ?

zbentahar avatar Jun 11 '16 12:06 zbentahar

The solution is to remove the .has_issues() check from line 81. It really makes no sense to skip analyzing pull requests when issues are disabled.

mgorny avatar Nov 25 '16 09:11 mgorny

Still happening :( The workaround from @mgorny doesn't help either.

$ github-pr-stats --basic https://github.com/libopencm3/libopencm3

Traceback (most recent call last):
  File "/home/karlp/src/libopencm3/.env/bin/github-pr-stats", line 151, in <module>
    bucketSize=arguments['--bucketSize'], plugins=arguments['--plugins'], url=githubUrl)
  File "/home/karlp/src/libopencm3/.env/lib/python2.7/site-packages/github_pr_stats/github_pr_stats.py", line 165, in analyze
    percentageMerged = 100 * (stats['merged'] / stats['count'])
ZeroDivisionError: division by zero

karlp avatar Jan 13 '17 20:01 karlp

I tweaked the L166 to get the percentage right in that case. Still I faced other bugs here and there

pplichart avatar Sep 12 '17 08:09 pplichart