[Mono-announce-list] Smokey 1.2 - assembly analyzer
jesjones at mindspring.com
Tue May 20 02:45:55 EDT 2008
Smokey is a command line tool used to analyze assemblies and report
problems. Problems include buggy code (e.g. infinite recursion, null
deref, malformed format string), performance issues (e.g. string
concatenation in loops, excessive boxing, large structs), violations
of the .NET design guidelines (e.g. inheriting from
ApplicationException or ICloneable, naming, and swallowing
exceptions), and miscellaneous rules like misspelled words in string
You can download Smokey from the web site:
<http://code.google.com/p/smokey/>. The web site also has an html
report for one of the System assemblies and a list of all of Smokey's
This release of Smokey has 212 rules which is more than FxCop and
twice as many as Gendarme. I've also moved the project to googlecode
and added some additional documentation on the associated wiki.
Changes from Smokey 126.96.36.199:
* Added 34 new rules:
ArithmeticButNoEquals, a type overloads the addition and subtraction
operators, but does not override Equals(object).
AvoidIsAlive, System.WeakReference::IsAlive was used.
BadExplicitImplementation, explicit interface implementation has no
DisposeDoesStaticRemove, Dispose does a remove from a static
DoubleCheckedLocking, wrong or inefficient double checked locking code.
FloatZeroDivide, floating point divide by zero.
FormatProvider, call the overload with an IFormatProvider.
InconsistentNamespace, a type's namespace matches a sibling
InconsistentProperty, trivial property uses one field for getter and
a different one for the setter.
IntZeroDivide, integer divide by zero.
NewVersion, newer version of Smokey is available.
NonLocalizedGui, selected gui method was called with a string literal.
NoStaticRemove, elements are never removed from a static collection.
NotSealed, class can be sealed but isn't.
ObjectDisposedException, IDisposable but doesn't throw
PreferMonitor1, prefer monitor pattern to events.
PreferMonitor2, prefer monitor pattern to mutex and semaphore.
PublicImplementation, methods in an implementation class should be
private instead of public.
RecursiveLock1, lock was used recursively.
RecursiveLock2, delegate or event was called while a lock was held.
SealedProtected, a sealed type declares a new protected member.
StringUri1, add an overload that takes a Uri.
StringUri2, use Uri instead of string for the property.
StringUri3, use Uri instead of string for the method result.
StringUriOverload, string method should call the uri overload.
UnprotectedEvent, event is fired without checking to see if it's null.
UnusualMonitor1, System.Monitor.Wait was called without looping.
UnusualMonitor2, System.Monitor.Wait was called without looping.
UnusedField, internal field is never used.
UseEmpty, a type with a public Empty field was default constructed
UseEmptyTypes, a zero length array of System.Type was created.
ValidateArgs, externally visible method doesn't check an arg for null.
VisiblePInvoke, p/invoke method is externally visible.
ZeroSleep, Sleep was called with a zero duration.
* Added support for a -profile command line switch. These act like
named sets of command line options. Currently the only supported
profile is "system" which sets a bunch of options suitable for
analyzing system assemblies. Custom profiles may be added via the
config file. See the wiki on googlecode for details.
* Added a -not-localized command line switch to disable a handful of
rules if the assembly is not localized.
* Added -include-check, -include-name, -include-breaking, and -
include-localized command line switches to enable profile options to
* ignoreList config setting is now deprecated: use the new dictionary
setting instead which supports multiple user dictionaries.
* User dictionaries are now handled by aspell and words-with-dashes
are split on the dashes before spell checking. Any words with dashes
should be removed from user dictionaries.
* The SysIgnore.txt dictionary is now a Smokey resource and can be
accessed with a path like "/resources/SysIgnore.txt".
* tar destfile's include the version number so that they unpack to a
reasonable directory name.
* install.sh won't overwrite smokey.exe.config if it already exists.
* MonoNamingRule complains if fields start with m_, s_, or ms_.
* EqualityOperatorRule ignores private structs.
* UnusedMethodRule ignores ctors if one of the types in the declaring
type's hierarchy has disabled UnusedClassRule.
* Made ClassPrefixRule and HungarianRule nitpicks.
* IgnoredReturnRule skips some more system methods.
* Compiler generated types are now processed. Among other things this
means that we don't report methods as unused if they are only used
from anonymous methods.
* ExitCodeRule works with local variables returned by the main entry
* ClassPrefixRule ignores classes that start with "I".
* Fixed a silly bug that sometimes kept UnusedMethodRule from
reporting the results.
* UseBaseTypesRule ignores parameters with generic types (they aren't
handled quite right by the rule).
* UseBaseTypesRule special cases base types that start with _,
notably _Exception and _Type.
* Main no longer returns negative ints.
More information about the Mono-announce-list