McCabe complexity for just changed files in a commit?

Chris Angelico rosuav at
Tue Oct 5 00:55:22 EDT 2021

On Tue, Oct 5, 2021 at 3:44 PM Kushal Kumaran <kushal at> wrote:
> On Sat, Oct 02 2021 at 09:05:47 PM, Dan Stromberg <drsalists at> wrote:
> > Hi folks.
> >
> > Is there a way of getting the McCabe Complexity of just the functions and
> > methods (in Python) changed in a git commit?
> >
> > I found radon, and it looks good.  But I think it wants to do entire files,
> > no?
> >
> Calculate your metric for this commit, calculate metric for parent
> commit, and take the difference?  That's how we do coverage metrics to
> report stuff like "change increases/decreases coverage by N%".

What if it has multiple parents, like a merge commit that resolves conflicts?

(A merge that doesn't make any other changes won't affect coverage or
complexity, since it's all done by the commits on either side.)


More information about the Python-list mailing list