A number of code quality checks and code transformations
are available via the
"Debug (Static Code Checks)" menu item,
or the toolbar button. Also, if the smallsense package is loaded and enabled
(see the Launcher's "tools" -> "smallLint" menu), checks are performed
"as you type" and possible problems marked with a little icon
in the left gutter area of a code view.
Many additional rules have been added to the original
set of rules, which were provided by the original refactory browser package.
As of February 2015, there are roughly 140 rules, many of which check for
multiple code smells and bug patterns.
The operations should be self describing (see the rationale display).
Here is a short, possibly incomplete list of checks:
- Bugs
- Messages sent but not implemented
- Overrides a "special" message
- References an undeclared variable
- Sublcass responsibility not defined
- Precedence check: "
A | B = C
" instead of "A | (B = C)
"
- Precedence check: "
C includes:e not
" instead of "(C includes:e) not
"
- Precedence check: "
(E and:[C indexOf:e]) ~~ 0
" instead of "E and:[(C indexOf:e) ~~ 0]
"
- True/False instead if true/false
- Variable used but not defined (no value)
- Bugs (Smalltalk/X specific)
- Leftover debug code
- Misplaced ^ in "
ifTrue:ifFalse:
" (stc bug workaround)
- Missing national language translations in dialogs
- Missing national language translations in resource files
- Bugs (Squeak specific)
- Leftover debug code
- Missing national language translations in menus
- Platform dependent user functions
- Sends a depricated message
- Sends super new initialize
- Possible Bugs
- Intention Revealing
- Class variable capitalization
- Doesn't use result of a "
collect:
" or "select:
"
- Guarding clauses
- Instance variable captialization
- Law of demeter
- Literal array containing only byte valued integers
- Literal array containing only characters
- Method defined in all subclasses, but not in super
- Obfuscated lazy initialization
- Sends "
add:/remove:
" to external collection
- Temporary variable captialization
- Unnecessary size check
- Uses contains instead of includes
- Uses "
size=0
", "=nil
" or "at:1
"
- uses "
detect:ifNone:
" instead of "contains:
" or "includes:
"
- Uses "
do:
" instead of "collect:
" or "select:
"
- Unnecessary Code
- Duplicate code (inherited or in another method)
- Variable not referenced
- Temporary variable not used
- Temporary variable not written (always nil)
- Instance variable only written or only read
- Variable always gets same literal value assigned
- Unnecessary "
not
"
- Portability Issues
- Detect ST/X specific syntactic extensions
- Style Checks
- Inconsistent classification
- Bad variable names
- Sends messages to Transcript/Stderr instead of using Logger
- Contains leftover debug code or FIXME/TODO marks
- Questionable messages such as "
become:
", "instVarAt:
", "halt
", etc.
- Missing comment
- Long methods
- Explicit class checks ("
instanceOf:
" / "isKindOf:
")
and transformations:
- General
- Rewrite old style assignments "_" to ":="
- Rewrite old style exception handlers (eq. "
handle:do:
") to Ansi versions (eg."on:do:
")
- Transformations (Smalltalk/X specific)
- Transformations (Squeak specific)
There are many more checks, not listed here in the msot up-to-date release.
Next: Code Generation
Copyright © 2000 eXept Software AG, all rights reserved
<info@exept.de>
Doc $Revision: 1.8 $ $Date: 2020/05/15 12:26:25 $