Bug 385476 - Warn on use of Qt autoconnected slots
Summary: Warn on use of Qt autoconnected slots
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-07 22:39 UTC by Nyall Dawson
Modified: 2017-12-15 17:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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