https://pharo.fogbugz.com/default.asp?15523

Ouch, burned by "you must match at the level of the parse tree you are
altering" again...

It is ridiculously easy to fall into the following trap - when rewriting,
you must match at the same level that you alter the parse tree. Thus, if
your rule has one statement, like "`@object setHaltOnce", you can just focus
on it...

Unless you want to remove it completely! Then, you are altering the parse
tree one level up, so you can't just write the above...

Unless you're working on a one-line method, in which case you are at the top
level and can do what you want!

Woah! WTH!!

Because of this common pitfall, RBCodeCruftLeftInMethodsRule was only
matching one-line methods (which are the only ones we test of course). I
rewrote it and added some tests.

Fix in inbox:
SLICE-Issue-15523-Code-Cruft-Rule-Only-Matches-One-Liners-SeanDeNigris.1

- Fix and clean RBCodeCruftLeftInMethodsRule to work on methods with
multiple lines
- Add tests for above
- Move Object halting methods into 'halting' protocol. I had originally put
them in an extension protocol, but Halt is in the same package, so that
doesn't make much sense!



-----
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/Issue-15523-Code-Cruft-Rule-Only-Matches-One-Liners-tp4825871.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply via email to