File: main.cpp

package info (click to toggle)
clazy 1.17-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 5,248 kB
  • sloc: cpp: 23,552; python: 1,450; xml: 450; sh: 237; makefile: 46
file content (34 lines) | stat: -rw-r--r-- 853 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QMultiMap>

QList<int> getList() {return {};}

void test()
{
    QList<int> list;
    if (list.count()) {}   // Warning
    if (!list.count()) {}   // Warning
    bool b1 = list.count(); // Warning
    bool b2 = list.size(); // Warning
    if (list.indexOf(1)) {} // OK

    QMap<int, int> map;
    if (map.count()) {} // Warning
    if (map.count(2)) {} // Warning

    QMultiMap<int, int> multiMap;
    if (multiMap.count()) {} // Warning
    if (multiMap.count(2)) {} // Warning
    if (multiMap.count(2, 3)) {} // Warning

    if (getList().count()) {} // Warning
}

void testExplicitConversion()
{
    if (getList().count() == 0) {} // Warning
    if (getList().count() < 1) {} // Warning
    if (getList().count() > 0) {} // Warning
    const bool myCheck = getList().count() > 0;
}