tonybaloney / wily

A Python application for tracking, reporting on timing and complexity in Python code
Apache License 2.0
1.2k stars 58 forks source link

Tracking complexity over git mv #84

Open KennethNielsen opened 5 years ago

KennethNielsen commented 5 years ago

Hi and thanks for the tool.

I recently read the "put your code in a src folder" article by Hynek and found that I agreed with basically everything. So I moved the code. The problem then is, that when I run wily on the archive, it only shows me stats on the part the history that is after the move. It would be cool if Wily could follow the git renaming heuristic and track the files across a move.

If this supposed to work already and isn't a feature request, I'm happy to provide more debugging information.

tonybaloney commented 5 years ago

Wow, that would be a beast of a challenge to implement! 😄

It is also an awesome suggestion.

There are a couple of ways this could be implemented:

  1. A command to rename the indexed files/modules to the new paths
  2. A definition of rename heuristics within the index so that it follow the history of files/folders. I don't know very much about git's rename capability and the support from within the Python library that wily uses.
KennethNielsen commented 5 years ago

@tonybaloney agreed that it isn't exactly simple. I was actually thinking something similar considering the two possible implementation pathways:

While I agree that 1 with something like a --formerly-known-as or --aka ;) option (which should of course work both for individual files and folders) is a more certain thing for an implementation, I will probably introduce some annoying special casing into, I guess, a quite central part of the implementation.

As far as 2 goes I can provide a bit of information. In git, since it doesn't track files, a move is a heuristic, so basically if git sees a file disappear and another appear and the are 80% content similar, it regards that a move and will show it as such when you look at the status before commit. I would therefore guess that it will also show it like that when you view history, but whether that is exposed in the python git module I'm not sure.

I would love to say that "I would like to work on this", which I would because I consider contributing to new codebases of cool tools a fun challenge, I'm afraid I have to little spare time these days.

I should also mention that I am not yet a significant Wily user, I just tested the tool after seeing you pycon talk and felt I should bring it up. So don't up prioritize it on my account ;)