Summary: | clazy-qstring-ref false positive with QVariant | ||
---|---|---|---|
Product: | [Developer tools] clazy | Reporter: | Elvis Angelaccio <elvis.angelaccio> |
Component: | general | Assignee: | Sergio Martins <smartins> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | smartins |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://commits.kde.org/clazy/a29aac041e1b6a9ad8ed83da9d66254ba8676c33 | Version Fixed In: | |
Sentry Crash Report: |
Description
Elvis Angelaccio
2017-02-20 21:54:55 UTC
Git commit 17db6590f46d7459868bf54df2ff54ec64e05acd by Sergio Martins. Committed on 20/02/2017 at 23:08. Pushed by smartins into branch '1.1'. qstring-ref: Add a failling unit-test for bug 376737 A +10 -0 tests/qstring-ref/bug376737.cpp [License: UNKNOWN] * A +0 -0 tests/qstring-ref/bug376737.cpp.expected M +4 -0 tests/qstring-ref/config.json The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. https://commits.kde.org/clazy/17db6590f46d7459868bf54df2ff54ec64e05acd Git commit e6931ef2554c5b67e042bd5d1ed03a4bd7e4a19d by Sergio Martins. Committed on 04/03/2017 at 14:05. Pushed by smartins into branch '1.1'. qstring-ref: Don't warn when a QStringRef wouldn't compile For example when there's an implicit converstion to QVariant M +46 -3 src/checks/level0/qstringref.cpp M +1 -0 src/checks/level0/qstringref.h M +1 -2 tests/qstring-ref/config.json https://commits.kde.org/clazy/e6931ef2554c5b67e042bd5d1ed03a4bd7e4a19d Hi Sergio, I rebuilt clazy with this commit but I'm still getting compilation errors after enabling the fixit. Is code like this supposed to compile? const QString attributes = line.midRef(13).trimmed(); (where midRef() was automatically added by the fixit) Git commit 68e5be34fc69a9f029d82dfd74beda2244e32701 by Sergio Martins. Committed on 06/03/2017 at 21:04. Pushed by smartins into branch '1.1'. Fix tests not reporting failure If a unit-test failed to compile it wouldn't report failure. Now it's evident that qstring-ref has a bug M +1 -1 tests/run_tests.py https://commits.kde.org/clazy/68e5be34fc69a9f029d82dfd74beda2244e32701 Git commit cc5c8a31449506fb3ca0ccb8066270ad472e473e by Sergio Martins. Committed on 17/03/2017 at 07:48. Pushed by smartins into branch '1.1'. qstring-ref: Fix cases where QStringRef wouldn't compile trimmed() must be treated like left() and right() because it also has an "overload" that returns QStringRef M +2 -2 src/checks/level0/qstringref.cpp M +1 -0 tests/qstring-ref/bug376737.cpp M +0 -1 tests/qstring-ref/main.cpp.expected https://commits.kde.org/clazy/cc5c8a31449506fb3ca0ccb8066270ad472e473e I think there are still some issues: error: no member named 'trimmedRef' in 'QString'; did you mean 'trimmed'? if (!m_tempComment.trimmedRef().isEmpty()) { where trimmedRef() was added by the fix-missing-qstringref fixit: - if (!m_comment.trimmed().isEmpty()) { + if (!m_comment.trimmedRef().isEmpty()) { Git commit a29aac041e1b6a9ad8ed83da9d66254ba8676c33 by Sergio Martins. Committed on 20/03/2017 at 11:23. Pushed by smartins into branch '1.1'. qstring-ref: There's no QString::trimmedRef() method M +1 -1 src/checks/level0/qstringref.cpp M +4 -0 tests/qstring-ref/bug376737.cpp https://commits.kde.org/clazy/a29aac041e1b6a9ad8ed83da9d66254ba8676c33 |