Tools__LintService.st
changeset 15076 c3c0c682a1e0
parent 15030 c8d7085ee271
child 15102 158d59b3ca69
--- a/Tools__LintService.st	Wed Dec 24 14:21:29 2014 +0100
+++ b/Tools__LintService.st	Wed Dec 24 14:43:19 2014 +0100
@@ -92,7 +92,7 @@
     | anns |
 
     (anns := self annotations) notNil ifTrue:[ 
-        anns do:[:annotation | annotation line = lineNo ifTrue:[ ^ annotation ] ]
+        ^ anns detect:[:annotation | annotation line = lineNo] ifNone:[nil]
     ].
     ^ nil
 
@@ -101,7 +101,7 @@
 !
 
 annotations
-    
+    #fixme. "/ code duplication with SmalltalkLintService >> annotations
     (highlighter notNil and:[ highlighter sequenceNumber ~~ annotationsSequenceNumber ]) ifTrue:[
         | rulesToIntervalsMap annotationsPerLineMap |
 
@@ -110,14 +110,21 @@
             annotationsPerLineMap := Dictionary new.
             rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals |
                 intervals do:[:interval | 
-                    | line annotation |
+                    | line annotation ruleAlready|
 
                     line := codeView lineOfCharacterPosition: interval first.
                     annotation := annotationsPerLineMap at: line ifAbsentPut:[ LintAnnotation new line: line ].
-                    annotation rule notNil ifTrue:[ 
-                        annotation rule isComposite 
-                            ifTrue: [ annotation rule rules add: rule ]
-                            ifFalse:[ annotation rule: (RBCompositeLintRule rules: (Array with: annotation rule with: rule))]
+                    ruleAlready := annotation rule.
+                    ruleAlready notNil ifTrue:[ 
+                        ruleAlready isComposite ifTrue: [ 
+                            (ruleAlready rules includes:rule) ifFalse:[
+                                ruleAlready addRule:rule "rules add: rule"
+                            ].
+                        ] ifFalse:[
+                            ruleAlready ~= rule ifTrue:[
+                                annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: ruleAlready with: rule))
+                            ]
+                        ]
                     ] ifFalse:[ 
                         annotation rule: rule
                     ].
@@ -309,10 +316,10 @@
 !LintService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.12 2014-12-15 20:27:23 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.13 2014-12-24 13:43:19 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.12 2014-12-15 20:27:23 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.13 2014-12-24 13:43:19 cg Exp $'
 ! !