class: SmallSense::SmalltalkLintService
class definition
changed:5 methods
(grafted from 385aed1f9547dc3a56fa32e954adc118ac8dfba0)
--- a/SmallSense__SmalltalkLintService.st Thu Aug 27 09:29:09 2015 +0200
+++ b/SmallSense__SmalltalkLintService.st Thu Aug 27 16:52:44 2015 +0200
@@ -15,7 +15,7 @@
Tools::BackgroundSourceProcessingService subclass:#SmalltalkLintService
instanceVariableNames:'rulesHolder rules highlighter support annotations
- annotationsSequenceNumber'
+ annotationsSequenceNumber annotationsPerLine'
classVariableNames:'Debugging'
poolDictionaries:''
category:'SmallSense-Smalltalk-Lint'
@@ -101,6 +101,7 @@
| anns |
(anns := self annotations) notNil ifTrue:[
+ ^ annotationsPerLine at: lineNo ifAbsent:[nil].
^ anns detect:[:annotation | annotation line = lineNo] ifNone:[ nil ]
].
^ nil
@@ -118,19 +119,20 @@
annotationsPerLineMap := Dictionary new.
rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals |
intervals do:[:interval |
- | line annotation |
+ | line annotation r |
line := codeView lineOfCharacterPosition: interval first.
annotation := annotationsPerLineMap at: line ifAbsentPut:[ Tools::LintAnnotation new line: line ].
- annotation rule notNil ifTrue:[
- annotation rule isComposite
- ifTrue: [ annotation rule addRule:rule "rules add: rule" ]
- ifFalse:[ annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: (annotation rule) with: rule))]
+ (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.
]
@@ -184,10 +186,12 @@
sourceChanged:force
| lang |
+ annotations := annotationsPerLine := nil.
+
rules isNil ifTrue:[ ^ self ].
+ rules resetResult.
((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ].
- rules resetResult.
- annotations := nil.
+
super sourceChanged:force.
"Created: / 18-02-2012 / 22:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -292,6 +296,7 @@
|lang cls env oldCodeList oldCode |
rules isNil ifTrue:[ ^ self ].
+
codeView codeAspect ~~ #method ifTrue:[ ^ self ].
(lang := codeView language) isNil ifTrue: [ ^ self ].
lang isSmalltalk ifFalse: [ ^ self ].
@@ -336,6 +341,8 @@
self showInfo:(('Smalltalk Lint: ',errMsg) colorizeAllWith:Color red).
] do:[
env := (SmallSense::SmalltalkUnacceptedMethodEnvironment onClass:cls methodSource: oldCode).
+Transcript showCR:rules.
+Transcript showCR:rules rules.
SmalltalkChecker runRule: rules onEnvironment: env
].
delayed ifTrue:[
@@ -424,11 +431,11 @@
!SmalltalkLintService class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/goodies/smallsense/SmallSense__SmalltalkLintService.st,v 1.2 2015-01-31 01:00:16 cg Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Path: stx/goodies/smallsense/SmallSense__SmalltalkLintService.st, Version: 1.0, User: cg, Time: 2015-01-31T02:00:40.102+01$'
+ ^ '$Header$'
!
version_HG
@@ -437,6 +444,6 @@
!
version_SVN
- ^ '$Id: SmallSense__SmalltalkLintService.st,v 1.2 2015-01-31 01:00:16 cg Exp $'
+ ^ '$Id$'
! !