Buy commercial curl support. We
help you work out your issues, debug your libcurl applications, use the API,
port to new platforms, add new features and more. With a team lead by the
curl founder Daniel himself.
Re: Goal: reduce overall function complexity
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Dan Fandrich via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 14 May 2025 14:46:34 -0700
On Wed, May 14, 2025 at 11:28:48PM +0200, Daniel Stenberg via curl-library wrote:
> Wouldn't it be cool to set a cap and make a subsequent CI job that turns red if any single
> function in product code is too complex? As a way to make sure we keep the code clean and
> readable.
Sounds like a noble goal to me.
> If this number is 100 or less we are good. If not, one or more functions are too complex.
According to Wikipedia, McCabe suggested a limit of 10 and NIST later suggested
some situations where 15 might be appropriate. So, 100 seems like a good
starting point!
> Right now, the top-10 most complex functions in production code according to this tool are (score,
> filename, line number, function name):
If the current few known-bad offenders are added to a whitelist, it becomes
easier to ratchet this number down over time. In fact, depending on how many
high-value functions there currently are, it might be better to start out with
a larger whitelist and lower limit.
Dan
Date: Wed, 14 May 2025 14:46:34 -0700
On Wed, May 14, 2025 at 11:28:48PM +0200, Daniel Stenberg via curl-library wrote:
> Wouldn't it be cool to set a cap and make a subsequent CI job that turns red if any single
> function in product code is too complex? As a way to make sure we keep the code clean and
> readable.
Sounds like a noble goal to me.
> If this number is 100 or less we are good. If not, one or more functions are too complex.
According to Wikipedia, McCabe suggested a limit of 10 and NIST later suggested
some situations where 15 might be appropriate. So, 100 seems like a good
starting point!
> Right now, the top-10 most complex functions in production code according to this tool are (score,
> filename, line number, function name):
If the current few known-bad offenders are added to a whitelist, it becomes
easier to ratchet this number down over time. In fact, depending on how many
high-value functions there currently are, it might be better to start out with
a larger whitelist and lower limit.
Dan
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2025-05-14