Bug 385476

Summary: Warn on use of Qt autoconnected slots
Product: [Developer tools] clazy Reporter: Nyall Dawson <nyall.dawson>
Component: generalAssignee: Sergio Martins <smartins>
Status: RESOLVED FIXED    
Severity: wishlist CC: eric.lemanissier, smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nyall Dawson 2017-10-07 22:39:42 UTC
As a follow up to #385475, I'd love to see a check for any use of Qt autoconnected slots. These are extremely fragile and don't have the compile time checking with Qt5 style connects add.

Ideally a fixit too for autoconverting these to new style connects would make things even easier...
Comment 1 Nyall Dawson 2017-10-08 08:51:33 UTC
Patch submitted as https://phabricator.kde.org/D8187
Comment 2 Sergio Martins 2017-10-08 10:44:00 UTC
thanks!

I'll have a look sometime this week, currently traveling
Comment 3 Sergio Martins 2017-12-15 16:57:41 UTC
commit 23dba8277d0595f08d2ece41c5366f248b7719ff (HEAD -> master, origin/master)
Author: Sergio Martins <iamsergio@gmail.com>
Date:   Fri Dec 15 16:34:38 2017 +0000

    new check: Introducing connect-by-name
    
    "auto connections" aka "connect by name" aka "slots named on_object_signal" are very flimsy
    as code easily breaks if someone renames an object later.
    
    Nowadays it's highly discouraged and unpopular.
    
    Thanks to Nyall for the suggestion.
    
    CCBUG: 385475
    CCBUG: 385476
Comment 4 Sergio Martins 2017-12-15 16:59:10 UTC
The fixit had some bugs, it's a bit complicated to cover all edge-cases, so I decided to just use the simplest implementation, so it can be a level 0 check.

Thanks for your suggestion, auto connected slots should really die