ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.38k stars 328 forks source link

Zero division error #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Below steps cannot be directly reproduced since the project it was measured by 
gitinspector is proprietary.

1. Clone gitinspector.
2. Run gitinspector with following options:
python gitinspector/gitinspector.py  --format=htmlembedded 
--localize-output=true --file-types=java,xml,js,properties 
../proprietary-project/ > stats.html

What is the expected output? What do you see instead?

Expected output: generated stats.html file for proprietary-project repository.
Instead ZeroDivisionError was encountered:

Traceback (most recent call last):
  File "gitinspector/gitinspector.py", line 194, in <module>
    main()
  File "gitinspector/gitinspector.py", line 182, in main
    __run__.output()
  File "gitinspector/gitinspector.py", line 76, in output
    outputable.output(blame.BlameOutput(self.hard, self.useweeks))
  File "/home/karma/git/gitinspector/gitinspector/outputable.py", line 36, in output
    outputable.output_html()
  File "/home/karma/git/gitinspector/gitinspector/blame.py", line 243, in output_html
    blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].rows, self.changes)) + "</td>")
  File "/home/karma/git/gitinspector/gitinspector/blame.py", line 175, in get_stability
    return 100.0 * blamed_rows / changes.get_authorinfo_list()[author].insertions
ZeroDivisionError: float division by zero

Please use labels and text to provide additional information.

If submitting a patch, you guarantee that you are the original author of
the work or that the patch is based on code from a compatible license.

Original issue reported on code.google.com by kamila.chyla on 15 Apr 2015 at 6:17

GoogleCodeExporter commented 9 years ago
git patch attached

Original comment by kamila.chyla on 15 Apr 2015 at 7:23

Attachments:

GoogleCodeExporter commented 9 years ago
Use Android framework/base to reproduce.
git clone https://android.googlesource.com/platform/frameworks/base

I've verified your patch.

Original comment by Michael....@gmail.com on 15 Apr 2015 at 9:12

GoogleCodeExporter commented 9 years ago
Thank you. I will include it in the next release.

/Adam Waldenberg

Original comment by gitinspe...@ejwa.se on 15 May 2015 at 8:57

adam-waldenberg commented 9 years ago

Done.