Summary: | Check for QString::left(1) mis-use. | ||
---|---|---|---|
Product: | [Developer tools] clazy | Reporter: | Volker Krause <vkrause> |
Component: | general | Assignee: | Sergio Martins <smartins> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | smartins |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/clazy/bb1c95331786149d0682be67653a725366358f0f | Version Fixed In: | |
Sentry Crash Report: |
Description
Volker Krause
2016-03-10 18:37:25 UTC
When shouldn't QString::left(1) be replaced by at(0) ? Wondering if we should just warn for all occurrences. I haven't found a valid use of left(1) yet, so an unconditional warning would probably be fine. In theory it differs from at(0) in that it returns a QString rather than a QChar, which doesn't matter for string concatenations or comparisons, but might be relevant in some other context. Git commit bb1c95331786149d0682be67653a725366358f0f by Sergio Martins. Committed on 05/05/2016 at 19:16. Pushed by smartins into branch 'master'. Introduce qstring-left check Warns when using QString::left(1) or QString::left(0). The former should be replaced by at(0), the later shouldn't be used and is probably a typo. M +1 -0 CMakeLists.txt M +1 -0 README A +4 -0 checks/README-qstring-left A +64 -0 checks/qstring-left.cpp [License: LGPL (v2+)] A +39 -0 checks/qstring-left.h [License: LGPL (v2+)] M +5 -5 tests/clazy/test_requested_checks.sh.expected A +7 -0 tests/qstring-left/config.json A +13 -0 tests/qstring-left/main.cpp [License: UNKNOWN] * A +2 -0 tests/qstring-left/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/bb1c95331786149d0682be67653a725366358f0f |