#BUGFIX by cg
class: Tools::LintHighlighter
comment/format in:
#format:in:
#format:tree:in:rule:
changed: #format:tree:in:
only attempt highlighting if the rule found something
before.
Otherwise, rules for which checkMethod: determined that
the rule should not be applied, and which were skipped
in the rule-run, will be reapplied anyway.
One such example is the RBNonBlockInValueSend rule,
which wants to only check user code
(but not stx:-packaged code).
Without this fix, it used to be tried twice; the first time
ignoring, the second time not.
--- a/Tools__LintHighlighter.st Sat Nov 05 14:06:37 2016 +0100
+++ b/Tools__LintHighlighter.st Sun Nov 06 11:53:21 2016 +0100
@@ -191,10 +191,11 @@
!LintHighlighter methodsFor:'formatting-private'!
format: sourceString in: class
-
| tree t |
- tree := RBParser parseMethod: sourceString string onError:[:error :pos| ^ sourceString ].
+ tree := RBParser
+ parseMethod: sourceString string
+ onError:[:error :pos| ^ sourceString ].
t := sourceString asText.
self format: t tree: tree in: class.
^t
@@ -204,11 +205,12 @@
!
format: text tree: tree in: class
-
rulesToIntervalsMap := Dictionary new.
sequenceNumber := sequenceNumber + 1.
rules ? #() do:[:rule|
- self format: text tree: tree in: class rule: rule
+ rule isEmpty ifFalse:[
+ self format: text tree: tree in: class rule: rule
+ ].
].
^text
@@ -217,7 +219,6 @@
!
format: text tree: tree in: class rule: rule
-
| string i |
string := text string.