[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    quality/krazy2
From:       Michael Leupold <lemma () confuego ! org>
Date:       2009-07-08 20:07:18
Message-ID: 1247083638.210786.15346.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 993511 by mleupold:

Allow qclasses to detect operator new with more than once space after.
Allow inheriting from QDialog but not from other qclasses.

 M  +3 -2      plugins/general/qclasses  
 M  +3 -2      testdata/foo.cpp  


--- trunk/quality/krazy2/plugins/general/qclasses #993510:993511
@@ -141,10 +141,10 @@
   my($l,$qname,$nregexp) = @_;
 
   if ($filetype eq "c++") {
-    if ($l =~ m/new[[:space:]]$qname[[:space:]]*\(/ ||
+    if ($l =~ m/new\s+$qname\s*\(/ ||
 	$l =~ m/$qname\::[[:alnum:]]+[[:space:]]*\(/ ||
 	$l =~ m/$qname[[:space:]]*\*[[:space:]]*[[:alnum:]]+/ ||
-	$l =~ m/\s*:\s*public\s$qname/ ||
+	$l =~ m/[:,]\s*public\s+$qname/ ||
 	(($l =~ m/=[[:space:]]*$qname\::/ || $l =~ m/=[[:space:]]*$qname[[:space:]]*\(/) && \
($l !~ m/==/ && $l !~ m/\!=/))) {  return 0 if ($nregexp ne "" && $l =~ m/$nregexp/);
       return 1 if (!&whiteList($l));
@@ -169,6 +169,7 @@
       $l =~ m/QUrl::fromAce/ ||
       $l =~ m/QDialog::DialogCode/ ||
       $l =~ m/QDialog::accept/ ||
+      $l =~ m/[:,]\s*public\s+QDialog/ ||
       $l =~ m/KServiceTypeTrader::createInstanceFromQuery<.*>/) {
     return 1;
   } else {
--- trunk/quality/krazy2/testdata/foo.cpp #993510:993511
@@ -72,10 +72,11 @@
         { j++; //not a hit
 
 // Deprecated Qt classes
-
 QHttp *http = new QHttp( "www.kde.org" );
+// inheriting from qclasses
+class MyDialog : public QDialog {}; // allowed
+class MyComboBox : public QComboBox {}; // forbidden
 
-
 //foreach
 foreach(const ptr<HeveaElement> &e, m_lstElts) {
  foo(e);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic