obsolete checks
authorClaus Gittinger <cg@exept.de>
Mon, 21 Apr 2008 18:06:10 +0200
changeset 8071 ab5e96fbfdb9
parent 8070 2acefb7023d2
child 8072 313da6c692f8
obsolete checks
Tools_ClassChecker.st
--- a/Tools_ClassChecker.st	Mon Apr 21 18:05:06 2008 +0200
+++ b/Tools_ClassChecker.st	Mon Apr 21 18:06:10 2008 +0200
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libtool' }"
 
 "{ NameSpace: Tools }"
@@ -44,8 +43,12 @@
     Provides an outputGenerator, which enumerates the classes in
     the selected categories.
 
+    Attention: do not change the method categories 'checks-' into something else.
+    The 'checks-' prefix is used to detect checks and these are listed in the browsers
+    lint dialog.
+
     [author:]
-	Claus Gittinger (cg@exept.de)
+        Claus Gittinger (cg@exept.de)
 "
 ! !
 
@@ -121,6 +124,8 @@
 
 styleChecks
     self doCheck:#checkProtocols.
+    self doCheck:#sendsObsoleteMethodWarningButNotTaggedAsObsoleteOrViceVersa.
+
 "/    self doCheck:#guardingClause.
 !
 
@@ -376,6 +381,33 @@
     ]
 !
 
+sendsObsoleteMethodWarningButNotTaggedAsObsoleteOrViceVersa
+    |obsoleteWarners|
+
+    obsoleteWarners := #( #'obsoleteMethodWarning' #'obsoleteMethodWarning:' ).
+
+    checkedClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | 
+        |lits sentMessages whichOnes pT searcher nodes|
+
+        ((lits := mthd literals) notNil
+        and:[lits includesAny:obsoleteWarners]) ifTrue:[
+            mthd isObsolete ifFalse:[
+                self 
+                    rememberBadMethod:mthd 
+                    key:#sendsObsoleteMethodWarningButNotTaggedAsObsoleteOrViceVersa
+                    info:('sends obsoleteMethodWarning but not tagged as obsolete')
+            ].
+        ] ifFalse:[
+            mthd isObsolete ifTrue:[
+                self 
+                    rememberBadMethod:mthd 
+                    key:#sendsObsoleteMethodWarningButNotTaggedAsObsoleteOrViceVersa
+                    info:('tagged as obsolete but does not send an obsoleteMethodWarning')
+            ].
+        ].
+    ]
+!
+
 sentNotImplemented
     |alreadyChecked alreadyCheckedSelf alreadyCheckedSuper|
 
@@ -791,5 +823,5 @@
 !ClassChecker class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassChecker.st,v 1.8 2006-03-10 09:54:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassChecker.st,v 1.9 2008-04-21 16:06:10 cg Exp $'
 ! !