aboutsummaryrefslogtreecommitdiffstats
path: root/tests/clazy
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2016-10-01 18:05:59 +0100
committerSergio Martins <smartins@kde.org>2016-10-01 18:05:59 +0100
commit91a12912995570bfb05a0403ac6d78aae03f670d (patch)
treea89df6302231c1ad4c99d90d8a74436485daf0af /tests/clazy
parent3b5ce296a48a25ec586f8843937bd8d7681bd437 (diff)
Fix clazy:excludeall= and clazy:exclude= when containing trailling junk
You can now have your own comments after clazy:exclude=check
Diffstat (limited to 'tests/clazy')
-rw-r--r--tests/clazy/config.json2
-rw-r--r--tests/clazy/suppressions.cpp9
-rw-r--r--tests/clazy/suppressions.cpp.expected2
3 files changed, 10 insertions, 3 deletions
diff --git a/tests/clazy/config.json b/tests/clazy/config.json
index 09925fd0..cfeca923 100644
--- a/tests/clazy/config.json
+++ b/tests/clazy/config.json
@@ -8,7 +8,7 @@
},
{
"filename" : "suppressions.cpp",
- "checks" : ["qstring-allocations", "foreach"]
+ "checks" : ["qstring-allocations", "foreach", "qdatetime-utc"]
},
{
"filename" : "suppressionsWholeFile.cpp",
diff --git a/tests/clazy/suppressions.cpp b/tests/clazy/suppressions.cpp
index 589ae4cf..0bea79f8 100644
--- a/tests/clazy/suppressions.cpp
+++ b/tests/clazy/suppressions.cpp
@@ -1,16 +1,18 @@
#include <QtCore/QString>
#include <QtCore/QList>
+#include <QtCore/QDateTime>
// clazy:excludeall=foreach
+// clazy:excludeall=qdatetime-utc comment with junk
void suppress_qstring_allocation()
{
QString s = "foo"; // clazy:exclude=qstring-allocations
if (s == "foo") {} // clazy:exclude=qstring-allocations
+ if (s == "foo") {} // clazy:exclude=qstring-allocations comment with other junk
if (s == "foo") {}
}
-
struct BigTrivial
{
int a, b, c, d, e;
@@ -21,3 +23,8 @@ void suppress_foreach()
QList<BigTrivial> list;
foreach (BigTrivial b, list) { }
}
+
+void qdatetimeutc()
+{
+ QDateTime::currentDateTime().toTime_t();
+}
diff --git a/tests/clazy/suppressions.cpp.expected b/tests/clazy/suppressions.cpp.expected
index 58c9f057..1d06dce3 100644
--- a/tests/clazy/suppressions.cpp.expected
+++ b/tests/clazy/suppressions.cpp.expected
@@ -1 +1 @@
-clazy/suppressions.cpp:10:9: warning: QString(const char*) being called [-Wclazy-qstring-allocations]
+clazy/suppressions.cpp:13:9: warning: QString(const char*) being called [-Wclazy-qstring-allocations]