Bug 374870 - new-check: warn about broken QLatin1String
Summary: new-check: warn about broken QLatin1String
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-10 14:28 UTC by Andre Woebbeking
Modified: 2017-01-11 20:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Woebbeking 2017-01-10 14:28:01 UTC
Hi, 

please add warning for QLatin1String used with non ASCII text.

Thanks in advance!

Cheers,
André
Comment 1 Sergio Martins 2017-01-10 14:37:37 UTC
probably non-latin1 instead of non-ascii ?
Comment 2 Andre Woebbeking 2017-01-10 15:36:44 UTC
Well, if you can distinguish non-latin1 from non-ascii. But given that most sources should be in UTF-8 nowadays I'm fine with non-ascii.
Comment 3 Sergio Martins 2017-01-11 20:52:21 UTC
Git commit dc46897735918e56bfb3026a66e324958badd79e by Sergio Martins.
Committed on 11/01/2017 at 20:50.
Pushed by smartins into branch 'master'.

Introduce qlatin1string-non-ascii

Passing non-ascii latin1 chars to QLatin1String() is weird since
source files are almost always UTF-8.

Check suggested by Andre Woebbeking.

M  +1    -0    CMakeLists.txt
M  +1    -0    README.md
A  +4    -0    checks/level1/README-qlatin1string-encoding.md
A  +54   -0    checks/level1/qlatin1string-non-ascii.cpp     [License: LGPL (v2+)]
A  +40   -0    checks/level1/qlatin1string-non-ascii.h     [License: LGPL (v2+)]
M  +8    -7    tests/clazy/test_requested_checks.sh.expected
A  +7    -0    tests/qlatin1string-non-ascii/config.json
A  +9    -0    tests/qlatin1string-non-ascii/main.cpp     [License: UNKNOWN]  *
A  +1    -0    tests/qlatin1string-non-ascii/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.


https://commits.kde.org/clazy/dc46897735918e56bfb3026a66e324958badd79e