ejwa / gitinspector

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

Guard against exceptions when commits is None due to extension filtering #149

Closed neontapir closed 7 years ago

neontapir commented 7 years ago

I found when using the -f flag that if I did not have any files that matched the -f arguments, I would get exceptions because self.commits contained NoneType commits. This patch prevents that situation from occurring through guard clauses and filtering out those unwanted entries.

Here's an example of the error:

$ git inspector -f md
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/Users/neontapir/git/github/neontapir/gitinspector/gitinspector/changes.py", line 170, in run
    commit.add_filediff(filediff)
AttributeError: 'NoneType' object has no attribute 'add_filediff'
adam-waldenberg commented 7 years ago

@neontapir Does this still occur with the latest version of the master branch ? I am unable to reproduce it.

neontapir commented 7 years ago

@adam-waldenberg it looks fixed. I was unable to reproduce after pulling the latest.

adam-waldenberg commented 7 years ago

@neontapir Great!