Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

All life evolves by the differential survival of replicating entities. -- Dawkins


devel / comp.lang.python / Re: McCabe complexity for just changed files in a commit?

SubjectAuthor
o Re: McCabe complexity for just changed files in a commit?Kushal Kumaran

1
Re: McCabe complexity for just changed files in a commit?

<mailman.926.1633412194.4164.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19970&group=comp.lang.python#19970

  copy link   Newsgroups: comp.lang.python
Path: rocksolid2!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: kushal@locationd.net (Kushal Kumaran)
Newsgroups: comp.lang.python
Subject: Re: McCabe complexity for just changed files in a commit?
Date: Mon, 04 Oct 2021 22:36:25 -0700
Lines: 40
Message-ID: <mailman.926.1633412194.4164.python-list@python.org>
References: <CAGGBd_oNTdVeBDZDymxSkubS2am-uRVzjBogFhbqb8yMMv7nCQ@mail.gmail.com>
<87fstgxf2y.fsf@locationd.net>
<CAPTjJmqD=z9iOd-qD4j8k2yHWh+uZHO9YpZZ5ptrcGnybwEh1Q@mail.gmail.com>
<87lf389go6.fsf@locationd.net>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: news.uni-berlin.de BSp4mWTqHUrI+GzGd8/vOgneu0Wq27nnWKJFkgcWNuYA==
Return-Path: <kushal@locationd.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'looks': 0.02; 'url-
ip:140.82/16': 0.03; 'random': 0.05; 'parent': 0.07; 'angelico':
0.09; 'dan': 0.09; 'git': 0.09; 'no?': 0.09; 'python)': 0.09;
'reporting': 0.09; 'resolved': 0.09; 'subject:files': 0.09;
'url:github': 0.14; 'url-ip:140/8': 0.15; 'commit': 0.16;
'kumaran': 0.16; 'kushal': 0.16; 'metric': 0.16; 'parents,': 0.16;
'practice,': 0.16; 'whichever': 0.16; 'wrote:': 0.16; 'pull':
0.17; 'pm,': 0.19; 'tue,': 0.19; 'to:addr:python-list': 0.20;
'sat,': 0.22; 'stuff': 0.25; 'done': 0.28; 'chris': 0.28;
'thinking': 0.28; 'header:User-Agent:1': 0.30; 'think': 0.32;
"doesn't": 0.32; 'context': 0.32; 'files,': 0.32; 'good.': 0.32;
'but': 0.32; "i'm": 0.33; 'subject:for': 0.33; 'there': 0.33;
'header:In-Reply-To:1': 0.34; 'functions': 0.36; 'those': 0.36;
"it's": 0.37; 'others': 0.37; 'way': 0.38; 'changes': 0.39;
'branch': 0.39; 'methods': 0.39; 'wants': 0.40; 'here.': 0.61;
'merge': 0.62; 'involve': 0.64; 'your': 0.64; 'look': 0.65;
'entire': 0.67; 'interested': 0.68; 'complexity': 0.69;
'interest': 0.70; '2021': 0.71; 'tools': 0.74; 'parents': 0.76;
'(first': 0.84; 'branches.': 0.84; 'metrics': 0.84; 'received:88':
0.84; 'affect': 0.91; 'heads': 0.91
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
arsenic.locationd.net
X-Spam-Level:
X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,BAYES_00
autolearn=ham autolearn_force=no version=3.4.2
X-Clacks-Overhead: GNU Terry Pratchett
In-Reply-To: <CAPTjJmqD=z9iOd-qD4j8k2yHWh+uZHO9YpZZ5ptrcGnybwEh1Q@mail.gmail.com>
(Chris Angelico's message of "Tue, 5 Oct 2021 15:55:22 +1100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <87lf389go6.fsf@locationd.net>
X-Mailman-Original-References: <CAGGBd_oNTdVeBDZDymxSkubS2am-uRVzjBogFhbqb8yMMv7nCQ@mail.gmail.com>
<87fstgxf2y.fsf@locationd.net>
<CAPTjJmqD=z9iOd-qD4j8k2yHWh+uZHO9YpZZ5ptrcGnybwEh1Q@mail.gmail.com>
 by: Kushal Kumaran - Tue, 5 Oct 2021 05:36 UTC

On Tue, Oct 05 2021 at 03:55:22 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Tue, Oct 5, 2021 at 3:44 PM Kushal Kumaran <kushal@locationd.net> wrote:
>>
>> On Sat, Oct 02 2021 at 09:05:47 PM, Dan Stromberg <drsalists@gmail.com> 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.)
>

In my usecases, merges are asymmetric: one of the parents is useful for
reporting metric changes, and the others are not. The parent of
interest will be whichever parent was on the mainline branch (first
parent). Whether the merge commit resolved conflicts or not makes no
difference here.

In practice, this does not involve doing commit math. The point where
this kind of thing is done is in context of a pull request, where it is
clearer what commits you're interested in comparing. When merging
branch X into branch Y, the tools only need to look at the heads of
those branches. https://github.com/vuejs/vue/pull/9373 is a random
example of the kind of thing I'm thinking of.

--
regards,
kushal


devel / comp.lang.python / Re: McCabe complexity for just changed files in a commit?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor