Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis bugs introduced by aeb9ad6 #68

Closed
brablc opened this issue Sep 24, 2015 · 11 comments
Closed

Analysis bugs introduced by aeb9ad6 #68

brablc opened this issue Sep 24, 2015 · 11 comments
Assignees
Milestone

Comments

@brablc
Copy link

brablc commented Sep 24, 2015

Commit aeb9ad6 broke generating for me (OSX):

Traceback (most recent call last):
  File "/usr/local/bin/gitinspector.py", line 194, in <module>
    main()
  File "/usr/local/bin/gitinspector.py", line 182, in main
    __run__.output()
  File "/usr/local/bin/gitinspector.py", line 73, in output
    outputable.output(changes.ChangesOutput(self.hard))
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 264, in __init__
    self.changes = get(hard)
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 255, in get
    __changes__ = Changes(hard)
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 203, in __init__
    if interval.has_interval() and len(commits) > 0:
NameError: global name 'commits' is not defined

I'm running gitinspector with these arguments:
gitinspector.py --file-types=php,tpl,css,js --format=html --timeline=true --responsibilities=true --metrics=true --exclude=file:cms/libs,file:admin/templates/emails,revision:8543c2474ade9a84df6ae5726ea89c825b12d721 --weeks=false '--since=last monday'

@adam-waldenberg
Copy link
Member

The cut & paste grinch strikes again. It should be referencing self.commits, not commits. I'll push up a fix shortly.

@adam-waldenberg
Copy link
Member

Done. The above fix should clear up the issue.

@brablc
Copy link
Author

brablc commented Sep 29, 2015

Now I have this on HEAD:

Traceback (most recent call last):
  File "/usr/local/bin/gitinspector.py", line 194, in <module>
    main()
  File "/usr/local/bin/gitinspector.py", line 182, in main
    __run__.output()
  File "/usr/local/bin/gitinspector.py", line 73, in output
    outputable.output(changes.ChangesOutput(self.hard))
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 275, in __init__
    self.changes = get(hard)
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 266, in get
    __changes__ = Changes(hard)
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 204, in __init__
    entry = entry.decode("utf-8", "replace").strip()
UnboundLocalError: local variable 'entry' referenced before assignment

This seems to be unrelated bug? Should I reported separately?

@adam-waldenberg
Copy link
Member

It's directly related to the same change (aeb9ad6).. So we can keep it here.

Could you try to print out the length of "lines" on row 192 when this happens ? Is git rev-list maybe returning an empty result?

@adam-waldenberg adam-waldenberg changed the title NameError: global name 'commits' is not defined Analysis bugs introduced by aeb9ad6 Sep 29, 2015
@brablc
Copy link
Author

brablc commented Sep 29, 2015

Yes, it is empty. I do a set of statistics (weekly, monthly) and some repos do not have changes. However, I believe there is a problem with indentation on line 203, which is creating scope for local variable.

@adam-waldenberg
Copy link
Member

Actually, lines 204-206 should be moved one indent block backwards. It won't change the behavior. The else is intended as an else/finalization condition for the for loop (https://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops). The problem is that it can enter the else immediately if there are no new commits. Thus resulting in "entry" not being declared at all.

I'll look at it now. It's easily reproducible with "--since".

@adam-waldenberg
Copy link
Member

Done. Hopefully all sorted out now.

@adam-waldenberg adam-waldenberg self-assigned this Sep 29, 2015
@brablc
Copy link
Author

brablc commented Sep 30, 2015

Still not quite there:

gitinspector.py --file-types=php,tpl,css,js --format=html --timeline=true --responsibilities=true --metrics=true '--exclude=file:cms/libs,file:admin/templates/emails,revision:8543c2474ade9a84df6ae5726ea89c825b12d721,message:[ignorestats]' --weeks=false '--since=last monday'
Traceback (most recent call last):
  File "/usr/local/bin/gitinspector.py", line 194, in <module>
    main()
  File "/usr/local/bin/gitinspector.py", line 182, in main
    __run__.output()
  File "/usr/local/bin/gitinspector.py", line 73, in output
    outputable.output(changes.ChangesOutput(self.hard))
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 277, in __init__
    self.changes = get(hard)
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 268, in get
    __changes__ = Changes(hard)
  File "/Users/ondrej/Projects/gitinspector/gitinspector/changes.py", line 220, in __init__
    self.first_commit_date = datetime.date(int(self.commits[0].date[0:4]), int(self.commits[0].date[5:7]),
IndexError: list index out of range

@adam-waldenberg
Copy link
Member

This time it's a bit more tricky. Taking a look see.

@adam-waldenberg
Copy link
Member

Let's hope for the best this time. Also, I opened issue #72 in order to mitigate the hit caused by bigger changes in the future.

@brablc
Copy link
Author

brablc commented Oct 1, 2015

Thank you very much. Now it is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants