[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: quality/krazy2/plugins/c++
From: Allen Winter <winter () kde ! org>
Date: 2009-01-04 23:10:54
Message-ID: 1231110654.821673.25484.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 905738 by winterz:
add check for QString::section(QString,..)
CCMAIL: Ch.Ehrlicher@gmx.de
M +25 -4 doublequote_chars
--- trunk/quality/krazy2/plugins/c++/doublequote_chars #905737:905738
@@ -46,7 +46,7 @@
use Krazy::Utils;
my($Prog) = "doublequote_chars";
-my($Version) = "1.12";
+my($Version) = "1.13";
&parseArgs();
@@ -74,6 +74,7 @@
my($scnt) = 0; #QString::startsWith(), QString::endsWith() issues
my($rcnt) = 0; #QString::replace() issues
my($xcnt) = 0; #QString::remove() issues
+my($tcnt) = 0; #QString::section() issues
my($spcnt) = 0; #QString::split() issues
my($linecnt) = 0;
my($line);
@@ -81,11 +82,12 @@
my($slstr) = "";
my($rlstr) = "";
my($xlstr) = "";
+my($tlstr) = "";
my($splstr) = "";
foreach $line (@lines) {
if ($line =~ m+//.*[Kk]razy:excludeall=.*$Prog+ ||
$line =~ m+//.*[Kk]razy:skip+) {
- $cnt = $scnt = $rcnt = $xcnt = $spcnt = 0;
+ $cnt = $scnt = $rcnt = $xcnt = $tcnt = $spcnt = 0;
last;
}
@@ -202,6 +204,24 @@
}
}
+ #QString::section() checks
+ if ($pline =~ m/section\s*\(\s*\"[[:print:]]\"/ ||
+ $pline =~ m/section\s*\(\s*\"\\n\"/ ||
+ $pline =~ m/section\s*\(\s*\"\\t\"/ ||
+ $pline =~ m/section\s*\(\s*\"\\r\"/ ||
+ $pline =~ m/section\s*\(\s*\"\\\"\"/) {
+ if ($pline !~ m/:section/) {
+ $tcnt++;
+ if ($tcnt == 1) {
+ $tlstr = "section issues line\#" . $linecnt;
+ } else {
+ $tlstr = $tlstr . "," . $linecnt;
+ }
+ print "=> $line\n" if (&verboseArg());
+ next;
+ }
+ }
+
#QString::split() checks
if ($pline =~ m/split\s*\(\s*\"[[:print:]]\"/ ||
$pline =~ m/split\s*\(\s*\"\\n\"/ ||
@@ -221,7 +241,7 @@
}
}
-my($total_count) = $cnt + $scnt + $rcnt + $xcnt + $spcnt;
+my($total_count) = $cnt + $scnt + $rcnt + $xcnt + $tcnt + $spcnt;
if (!$total_count) {
print "okay\n" if (!&quietArg());
exit 0;
@@ -231,6 +251,7 @@
print "$slstr ($scnt)\n" if ($scnt);
print "$rlstr ($rcnt)\n" if ($rcnt);
print "$xlstr ($xcnt)\n" if ($xcnt);
+ print "$tlstr ($tcnt)\n" if ($tcnt);
print "$splstr ($spcnt)\n" if ($spcnt);
}
exit $total_count;
@@ -247,6 +268,6 @@
}
sub Explain {
- print "Adding single characters to a QString is faster if the characters are \
QChars and not QStrings. For example: QString path = oldpath + \"/\" + base is \
better written as QString path = oldpath + \'/\' + base. Same holds for arguments to \
QString::startsWith(), QString::endsWith(), QString::remove() and QString::split(). \
Use QString::remove() instead of QString::replace(foo,\"\")\n"; + print "Adding \
single characters to a QString is faster if the characters are QChars and not \
QStrings. For example: QString path = oldpath + \"/\" + base is better written as \
QString path = oldpath + \'/\' + base. Same holds for arguments to \
QString::startsWith(), QString::endsWith(), QString::remove(), QString::section(), \
and QString::split(). Use QString::remove() instead of QString::replace(foo,\"\")\n"; \
exit 0 if &explainArg(); }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic