[clazy] [Bug 355682] new check: test QList.count() must be replaced by !QList.isEmpty()
https://bugs.kde.org/show_bug.cgi?id=355682 eric.lemaniss...@gmail.com changed: What|Removed |Added CC||eric.lemaniss...@gmail.com --- Comment #3 from eric.lemaniss...@gmail.com --- The suggestion to replace container::count with !container::isEmpty works only if there is no argument to container::count. Otherwise container::contains should be suggested -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 355682] new check: test QList.count() must be replaced by !QList.isEmpty()
https://bugs.kde.org/show_bug.cgi?id=355682 --- Comment #2 from Stephane MANKOWSKI--- Hi, Thank you, this helps me a lot. Just one more comment: could be interesting to generate warning for the 2 followings cases too ! if (list.count()>0) {} if (list.count()==0) {} -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 355682] new check: test QList.count() must be replaced by !QList.isEmpty()
https://bugs.kde.org/show_bug.cgi?id=355682 Sergio Martinschanged: What|Removed |Added Status|UNCONFIRMED |RESOLVED Latest Commit||http://commits.kde.org/claz ||y/ef337e2facc0dcae72c84917d ||0c678b02031b06e Resolution|--- |FIXED --- Comment #1 from Sergio Martins --- Git commit ef337e2facc0dcae72c84917d0c678b02031b06e by Sergio Martins. Committed on 07/12/2015 at 18:40. Pushed by smartins into branch 'master'. Introduce isempty-vs-count check if (list.count()) -> if (!list.isEmpty()) This is just a warning, if someone is interested in doing the fixit please volunteer. M +1-0CMakeLists.txt A +9-0checks/README-isempty-vs-count A +62 -0checks/isempty-vs-count.cpp [License: GPL (v2+) (+Qt exception)] A +46 -0checks/isempty-vs-count.h [License: GPL (v2+) (+Qt exception)] M +11 -11 tests/clazy/test_requested_checks.sh.expected A +7-0tests/isempty-vs-count/config.json A +10 -0tests/isempty-vs-count/main.cpp [License: UNKNOWN] * A +3-0tests/isempty-vs-count/main.cpp.expected 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. http://commits.kde.org/clazy/ef337e2facc0dcae72c84917d0c678b02031b06e -- You are receiving this mail because: You are watching all bug changes.