Anonymous | Login | Signup for a new account | 2025-06-19 02:19 UTC | ![]() |
My View | View Issues | Change Log | Roadmap | Doomseeker Issue Support Ranking | Rules | My Account |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0003809 | Doomseeker | [All Projects] Cleanup | public | 2020-06-07 03:54 | 2020-06-08 01:04 | ||||||||
Reporter | WubTheCaptain | ||||||||||||
Assigned To | |||||||||||||
Priority | none | Severity | tweak | Reproducibility | sometimes | ||||||||
Status | confirmed | Resolution | open | ||||||||||
Platform | OS | OS Version | |||||||||||
Product Version | 1.3.1 | ||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0003809: Some string literals with escaped characters are not raw string literals (modernize-raw-string-literal) | ||||||||||||
Description | Ugly escape characters in some source code, impeding readability. | ||||||||||||
Steps To Reproduce | Some examples from a common regex:$ grep -r "a-z" src/ src/plugins/zandronum/zandronumserver.cpp:const QRegExp ZandronumVersion::versionExpression(R"((\d+).(\d+)(?:.(\d+)(?:.(\d+))?)?(?:-([a-zA-Z]*)?)?(?:-r(\d+)(?:-(\d+))?)?)"); src/plugins/zandronum/zandronumrconprotocol.cpp: static const QRegExp colorCode(R"(\\c(\[[a-zA-Z0-9]*\]|[a-v+\-!*]))"); src/core/gui/widgets/serverconsole.cpp: static const QRegExp colorCode("\034(\\[[a-zA-Z0-9]*\\]|[a-v+\\-!*])"); src/core/irc/ircnicknamecompleter.cpp: const QString NICKNAME_MATCH = R"(\[\]\{\}\-\^\`\|\\A-Za-z0-9_)"; src/core/commandline.cpp: QRegExp reallySafestCharsIHope = QRegExp("[^a-z0-9/\\_-+]", Qt::CaseInsensitive); src/core/serverapi/serverstructs.cpp: return name.toLower().remove(QRegExp("[^a-z0-9]")); Notice serverconsole.cpp and commandline.cpp containing a double backslash (escape characters). Some of these may be better as raw string literals: $ grep -r '\\\"' src/ | wc -l 127 | ||||||||||||
Additional Information | 'https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html [^]' | ||||||||||||
Attached Files | |||||||||||||
![]() |
|
WubTheCaptain (reporter) 2020-06-07 03:56 |
Also looking closer, some of those regexes might look suspect while being parsed as raw string literals (instead of just string literals). |
Blzut3 (administrator) 2020-06-08 01:04 |
Actually somehow missed that C++ had these raw string literally until a few weeks ago. Converting the escape heavy strings (like the regexps) would be a nice way to tidy things up, but yeah you would definitely need to make sure that they're coming out of the transformation correctly. |
Only registered users can voice their support. Click here to register, or here to log in. | |
Supporters: | No one explicitly supports this issue yet. |
Opponents: | No one explicitly opposes this issue yet. |
![]() |
|||
Date Modified | Username | Field | Change |
2020-06-07 03:54 | WubTheCaptain | New Issue | |
2020-06-07 03:56 | WubTheCaptain | Note Added: 0021362 | |
2020-06-07 19:57 | Pol M | Status | new => confirmed |
2020-06-08 01:04 | Blzut3 | Note Added: 0021404 |
Copyright © 2000 - 2025 MantisBT Team |