[Mono-list] [ANN] Smokey 1.3 - assembly analyzer

Jesse Jones jesjones at mindspring.com
Thu Jun 12 04:23:32 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  
literals.

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  
rules.

This release of Smokey has 220 rules which is more than FxCop and  
twice as many as Gendarme.

Changes from Smokey 1.2:
* Added nine new rules:
	- ArgumentException1, ArgumentException constructed with an arg name.
	- ArgumentException2, ArgumentNullException or  
ArgumentOutOfRangeException constructed without an arg name.
	- AvoidReRegisterForFinalize, don't use GC.ReRegisterForFinalize.
	- HashUsesXor, don't use xor to combine hashes.
	- IdentifierCasing, two externally visible names differ only by case.
	- PropertyMatchesAccessor, type has a Foo property and a GetFoo or  
SetFoo method.
	- PropertyReturnsCollection, property returns a mutable collection.
	- TooManyLocals, method has over 64 local variables.
	- UnusedArg, non-empty method doesn't use an argument.
* Removed DisposeDoesStaticRemoveRule.
* AttributesNeedUsageRule doesn't complain if the type is abstract.
* NonSerializableFieldRule doesn't complain if the type implements  
ISerializable.
* CastOpAlternativeTestRule doesn't complain if the type is only  
missing FromFooType.
* Const2Rule only complains if the type is public.
* UnusedMethodRule:
	- Can now disable the rule for derived ctors by decorating a base  
class ctor.
	- Don't complain if the method is decorated with an attribute which  
disables  the rule.
	- Don't complain about the () and (SerializationInfo,  
StreamingContext)  constructors if the type is serializeable.
	- Don't complain about inner exception constructors.
	- Don't complain about custom event add/remove methods.
	- Sort results by declaring type and method name, not by return type.
* Fields that are collections of IntPtr are now considered to be  
native types. This affects DisposableButNoFinalizerRule,  
IDisposableWithoutSuppressFinalizeRule, and DisposeNativeResourcesRule.
* Don't terminate if a custom rule can't be loaded.
* Fixed Dispose language in the rules to make it clear that managed  
fields can always be used but finalizeable fields cannot.
* Sped up unit tests a huge amount (mainly by instantiating one  
AssemblyDefinitions instead of over 200).
* Switched to make files instead of nant.

   -- Jesse


More information about the Mono-list mailing list