[clazy] [Bug 423780] clazy-fully-qualified-moc-types not detecting missing namespace

Evgeniy A. Dushistov bugzilla_noreply at kde.org
Thu Apr 15 17:39:56 BST 2021


https://bugs.kde.org/show_bug.cgi?id=423780

--- Comment #2 from Evgeniy A. Dushistov <dushistov at mail.ru> ---
I made some experiments, and looks like clazy should be run against output of
moc, not against header by it self:

```
// boo.h
#pragma once

#include <QObject>

namespace MyNameSpace {

    struct MyGadget {
        Q_GADGET
    };

    class MyObject : public QObject
    {   
        Q_OBJECT
        Q_PROPERTY(MyGadget myprop READ myprop CONSTANT); // Wrong, needs
namespace
    public:
        MyGadget myprop() const;
    };
}
```

clazy-standalone --extra-arg="-I/usr/lib/clang/11.1.0/include"
--checks=level0,level1,level2   -p ./build/compile_commands.json boo.h

reports nothing,
but

```
$ clazy-standalone --extra-arg="-I/usr/lib/clang/11.1.0/include"
--checks=level0,level1,level2   -p ./build/compile_commands.json
build/moc_boo.cpp
In file included from moc_boo.cpp:10:
build/../boo.h:11:5: warning: Q_PROPERTY of type MyGadget should use full
qualification (MyNameSpace::MyGadget) [-Wclazy-fully-qualified-moc-types]
    class MyObject : public QObject
    ^
1 warning generated.
```

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list