#QUALITY by cg
class: SmallSense::SmalltalkLintService
changed:
#annotationAtLine:
#annotations
--- a/SmallSense__SmalltalkLintService.st Wed May 04 13:04:02 2016 +0200
+++ b/SmallSense__SmalltalkLintService.st Wed May 04 21:49:01 2016 +0200
@@ -101,8 +101,8 @@
| anns |
(anns := self annotations) notNil ifTrue:[
- ^ annotationsPerLine at: lineNo ifAbsent:[nil].
- ^ anns detect:[:annotation | annotation line = lineNo] ifNone:[ nil ]
+ ^ annotationsPerLine at: lineNo ifAbsent:[nil].
+ "/ ^ anns detect:[:annotation | annotation line = lineNo] ifNone:[ nil ]
].
^ nil
@@ -111,31 +111,31 @@
!
annotations
- (highlighter notNil and:[ highlighter sequenceNumber ~~ annotationsSequenceNumber ]) ifTrue:[
- | rulesToIntervalsMap annotationsPerLineMap |
+ | rulesToIntervalsMap annotationsPerLineMap |
- rulesToIntervalsMap := highlighter rulesToIntervalsMap.
- rulesToIntervalsMap notNil ifTrue:[
- annotationsPerLineMap := Dictionary new.
- rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals |
- intervals do:[:interval |
- | line annotation r |
+ (highlighter notNil and:[ highlighter sequenceNumber ~~ annotationsSequenceNumber ]) ifTrue:[
+ rulesToIntervalsMap := highlighter rulesToIntervalsMap.
+ rulesToIntervalsMap notEmptyOrNil ifTrue:[
+ annotationsPerLineMap := Dictionary new.
+ rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals |
+ intervals do:[:interval |
+ | line annotation r |
- line := codeView lineOfCharacterPosition: interval first.
- annotation := annotationsPerLineMap at: line ifAbsentPut:[ Tools::LintAnnotation new line: line ].
- (r := annotation rule) notNil ifTrue:[
- r isComposite
- ifTrue: [ r addRule:rule "rules add: rule" ]
- ifFalse:[ annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: r with: rule))]
- ] ifFalse:[
- annotation rule: rule
- ].
- ].
- ].
- annotationsPerLine := annotationsPerLineMap.
- annotations := annotationsPerLineMap values sort:[ :a :b | a line < b line ].
- annotationsSequenceNumber := highlighter sequenceNumber.
- ]
+ line := codeView lineOfCharacterPosition: interval first.
+ annotation := annotationsPerLineMap at: line ifAbsentPut:[ Tools::LintAnnotation new line: line ].
+ (r := annotation rule) notNil ifTrue:[
+ r isComposite
+ ifTrue: [ r addRule:rule "rules add: rule" ]
+ ifFalse:[ annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: r with: rule))]
+ ] ifFalse:[
+ annotation rule: rule
+ ].
+ ].
+ ].
+ annotationsPerLine := annotationsPerLineMap.
+ annotations := annotationsPerLineMap values sort:[ :a :b | a line < b line ].
+ annotationsSequenceNumber := highlighter sequenceNumber.
+ ]
].
^annotations