How to ignore Code Critics rules?

A less well known feature of my recent changes and improvements to the Refactoring Browser, and especially the integrated Code Critic tools (including Slime, the Seaside consultant in a box) is the possibility to ignore certain rules on annotated methods. Simply add a pragma to the method you want a certain rule to ignore:

renderContentOn: html
"Renders the basic structure of the application."

<lint: 'Long methods' rationale: 'Rendering method' author: 'lr'>

The first argument is the title of the rule, as it appears in code critics user interface. Second and third argument are optional, but it usually makes sense to explain why it is a good decision to ignore the rule in the given method.

The idea is not to overuse this feature. That’s also why you actually have to type it in all by hand, even if it would be easy to automate that. The goal is to encourage developers to fix the real issue instead, something that works very well for me.

Posted by Lukas Renggli at 25 October 2008, 12:11 pm with tags refactoring, omnibrowser link


Excellent... very useful. I was worried about how you would use the lint tool if it kept warning you about stuff that you had decided was fine. Would be very hard to see the real problems.

Should the pragma be named something more like "lint-ignore:" though?

Posted by Julian at 25 October 2008, 2:07 pm link

The latest version additionally supports a more readable from:

&lt;ignoreLintRule: 'Long methods' rationale: 'Rendering method' author: 'lr'>

Furthermore, instead of the rule name the name of the class implementing the rule can be provided:

&lt;ignoreLintRule: #RBLongMethodRule rationale: 'Rendering method' author: 'lr'>
Posted by Lukas Renggli at 24 February 2009, 7:41 pm link