added check for variable name conventions
authorClaus Gittinger <cg@exept.de>
Mon, 08 Oct 2001 13:04:56 +0200
changeset 3268 1e2896e1b1a1
parent 3267 4b70e02d1549
child 3269 9566fbc92617
added check for variable name conventions
NewSystemBrowser.st
Tools__NewSystemBrowser.st
--- a/NewSystemBrowser.st	Mon Oct 08 11:19:01 2001 +0200
+++ b/NewSystemBrowser.st	Mon Oct 08 13:04:56 2001 +0200
@@ -13393,6 +13393,7 @@
     |checker badMethodInfo badClassInfo theSingleClass lbl badMethods|
 
     checker := ClassChecker new.
+
     self selectedClassesWithWaitCursorDo:[:eachClass | |cls|
         cls := eachClass theNonMetaclass.
         cls isLoaded ifTrue:[
@@ -26912,7 +26913,7 @@
                 ].
                 numFound := initialList size.
                 numFound == 0 ifTrue:[
-                    self information:((label bindWith:string allBold) , ' - none found.').
+                    self information:((label bindWith:(string ? '') allBold) , ' - none found.').
                     ^ self
                 ].
                 (numFound == 1 and:[initialList first == self theSingleSelectedMethod]) ifTrue:[
@@ -32420,6 +32421,7 @@
     "set the value of the instance variable 'checkedClass' (automatically generated)"
 
     checkedClass := something.
+    checksPerformed := nil.
 ! !
 
 !NewSystemBrowser::ClassChecker methodsFor:'checking'!
@@ -32470,6 +32472,26 @@
     ]
 !
 
+checkVariableNameConventions
+    |badInstVars badClassVars|
+
+    badInstVars := checkedClass instanceVariableNames select:[:varName | varName first isUppercase].
+    badClassVars := checkedClass classVarNames select:[:varName | varName first isLowercase].
+
+    badInstVars notEmpty ifTrue:[
+        badInstVars := (badInstVars collect:[:v | '''' , v , '''']) asStringWith:$, .
+        self 
+            rememberBadClass:checkedClass
+            info:('instVars ' , badInstVars , ' should be lowercase (#checkNameConventions)').
+    ].
+    badClassVars notEmpty ifTrue:[
+        badClassVars := (badClassVars collect:[:v | '''' , v , '''']) asStringWith:$, .
+        self 
+            rememberBadClass:checkedClass
+            info:('classVars ' , badClassVars , ' should be uppercase (#checkNameConventions)').
+    ].
+!
+
 classInstanceVariablesNeverUsed
     self instanceVariablesNeverUsedIn:checkedClass theMetaclass.
 !
@@ -50142,6 +50164,6 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.202 2001-10-08 09:19:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.203 2001-10-08 11:04:56 cg Exp $'
 ! !
 NewSystemBrowser initialize!
--- a/Tools__NewSystemBrowser.st	Mon Oct 08 11:19:01 2001 +0200
+++ b/Tools__NewSystemBrowser.st	Mon Oct 08 13:04:56 2001 +0200
@@ -13393,6 +13393,7 @@
     |checker badMethodInfo badClassInfo theSingleClass lbl badMethods|
 
     checker := ClassChecker new.
+
     self selectedClassesWithWaitCursorDo:[:eachClass | |cls|
         cls := eachClass theNonMetaclass.
         cls isLoaded ifTrue:[
@@ -26912,7 +26913,7 @@
                 ].
                 numFound := initialList size.
                 numFound == 0 ifTrue:[
-                    self information:((label bindWith:string allBold) , ' - none found.').
+                    self information:((label bindWith:(string ? '') allBold) , ' - none found.').
                     ^ self
                 ].
                 (numFound == 1 and:[initialList first == self theSingleSelectedMethod]) ifTrue:[
@@ -32420,6 +32421,7 @@
     "set the value of the instance variable 'checkedClass' (automatically generated)"
 
     checkedClass := something.
+    checksPerformed := nil.
 ! !
 
 !NewSystemBrowser::ClassChecker methodsFor:'checking'!
@@ -32470,6 +32472,26 @@
     ]
 !
 
+checkVariableNameConventions
+    |badInstVars badClassVars|
+
+    badInstVars := checkedClass instanceVariableNames select:[:varName | varName first isUppercase].
+    badClassVars := checkedClass classVarNames select:[:varName | varName first isLowercase].
+
+    badInstVars notEmpty ifTrue:[
+        badInstVars := (badInstVars collect:[:v | '''' , v , '''']) asStringWith:$, .
+        self 
+            rememberBadClass:checkedClass
+            info:('instVars ' , badInstVars , ' should be lowercase (#checkNameConventions)').
+    ].
+    badClassVars notEmpty ifTrue:[
+        badClassVars := (badClassVars collect:[:v | '''' , v , '''']) asStringWith:$, .
+        self 
+            rememberBadClass:checkedClass
+            info:('classVars ' , badClassVars , ' should be uppercase (#checkNameConventions)').
+    ].
+!
+
 classInstanceVariablesNeverUsed
     self instanceVariablesNeverUsedIn:checkedClass theMetaclass.
 !
@@ -50142,6 +50164,6 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.202 2001-10-08 09:19:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.203 2001-10-08 11:04:56 cg Exp $'
 ! !
 NewSystemBrowser initialize!