On Correctly Spelling Variable Names

The code critics tool of the Refactoring Browser points out all kinds of code smells. However, correct spelling of entities in source code is an often neglected smell and remains unchecked by the traditional rules.

As an example take the current development version of Seaside. In my development image there are 8757 methods. In total these methods declare 1403 temporary variables. 84 variables are marked because of suspicious spelling. About a quarter of these variables are actually spelled wrong.

Spelling.jpg

I published a new extension to code critics. Load the latest versions of Refactoring-Core and Refactoring-Spelling from the repository on SqueakSource. Use the OmniBrowser integration to run the checks. If you run on OS X, the spell checker of the system is used thanks to the excellent plugin of John McIntosh. On other platforms, a weaker built-in spell checker is used. The checks work at the level of AST nodes and individually check the following code elements:

  • class names
  • class comments
  • class categories
  • instance variable names
  • class variable names
  • pool variable names
  • method protocols
  • method selectors
  • method comments
  • literal values
  • argument variable names
  • temporary variable names

Given that the spell checker is not integrated with Pier yet, it is up to you to find the spelling errors in this post.

Posted by Lukas Renggli at 8 February 2009, 2:48 pm with tags smalltalk, refactoring, lint, omnibrowser link

Comments

Very nice!

Posted by AA at 8 February 2009, 3:38 pm link

This is cool :)

Posted by Tudor Girba at 8 February 2009, 7:01 pm link