[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] Chutney code refactoring



Hi Caitlin,

> On 15 May 2020, at 09:59, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
> 
> On Thu, May 14, 2020 at 7:04 PM c <c@xxxxxxxxxxx> wrote:
>> 
>>> On Sat, 18 Apr 2020 11:02:03 +0000
>>> c <c@xxxxxxxxxxx> wrote:
>>> 
>>> I came across Node.specialize() which does not seem to be called
>>> elsewhere, and I cannot guess at its purpose.
>> 
>> I ran vulture (a static analyzer for dead code), trimmed the output to
>> omit things I know were being used (some functions/attributes are used
>> solely in Python 2), and found these unused names:
>> 
>> lib/chutney/Templating.py:280: unused function 'getUpdateTime' (60% confidence)
>> lib/chutney/TorNet.py:439: unused function 'specialize' (60% confidence)
>> lib/chutney/TorNet.py:658: unused function '_getFreeVars' (60% confidence)
>> lib/chutney/TorNet.py:1232: unused function 'isBootstrapped' (60% confidence)
>> lib/chutney/TorNet.py:1799: unused function 'isInExpectedDirInfoDocs' (60% confidence)
>> lib/chutney/TorNet.py:2151: unused function 'configure' (60% confidence)
>> lib/chutney/TorNet.py:2191: unused function 'restart' (60% confidence)
>> lib/chutney/TorNet.py:2286: unused function 'wait_for_bootstrap' (60% confidence)
>> lib/chutney/Traffic.py:335: unused attribute 'am_closing' (60% confidence)
>> lib/chutney/Traffic.py:345: unused attribute 'am_closing' (60% confidence)
>> lib/chutney/Traffic.py:400: unused attribute 'pending_close' (60% confidence)
>> lib/chutney/Traffic.py:406: unused attribute 'dot_repetitions' (60% confidence)
>> 
>> Aside from isBootstrapped() which we discussed previously and are
>> likely going to use, is there any code that stands out as unnecessary
>> or dead?
> 
> Hm. Of these:
> 
> isInExpectedDirInfoDocs looks like it might once have done something useful.
> 
> configure and restart and wait_for_bootstrap are all in use; they are
> invoked by name, from the command line, at the end of runConfigFile,
> where it says `return getattr(network, verb)()`.
> 
> I think the rest are likely to be unused.

You could try deleting functions, and then running tor's
"make test-network-all". If that test still passes, then the code is probably
unused (in practice).

Chutney's CI does a few more tests for different tor versions, but I'm pretty
sure they all use the same code.

T

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev