packj icon indicating copy to clipboard operation
packj copied to clipboard

Unitialised variable returned by `analyze_repo_activity`

Open KyeRussell opened this issue 1 year ago • 1 comments

As seen here: https://github.com/ossillate-inc/packj/blob/0b1d39118539e7c13dd5a7941da11948a46534af/packj/audit/main.py#L454-L470

analyze_repo_activity()'s return value is determined by the finally: block on line 470. finally: runs regardless of the success of running the associated try:.

repo_data is set in line 458: https://github.com/ossillate-inc/packj/blob/0b1d39118539e7c13dd5a7941da11948a46534af/packj/audit/main.py#L458-L459

So you can end up with:

[+]    Checking repo activity...............FAIL [[Errno 24] Too many open files: '/var/folders/45/ssw660y51fv24md76zh0w2600000gn/T/clone-_lolhhw7/django-axes/axes/locale/pl/LC_MESSAGES']
local variable 'repo_data' referenced before assignment

Obviously the git_clone call failing (output: 'Too many open files') is the underlying issue, but analyze_repo_activity()'s behaviour is a bad smell + results in extra output that may confuse some users.

KyeRussell avatar Mar 29 '24 05:03 KyeRussell

Thanks for reporting! I've created a PR: https://github.com/ossillate-inc/packj/pull/97 Would appreciate if you could review.

ashishbijlani avatar Mar 29 '24 17:03 ashishbijlani

Fixed by https://github.com/ossillate-inc/packj/pull/97

ashishbijlani avatar Apr 02 '24 22:04 ashishbijlani