[Mono-dev] [ANN] Smokey- Assembly Analyzer

Jesse Jones jesjones at mindspring.com
Wed Sep 26 06:50:56 EDT 2007

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: <https://home.comcast.net/ 
~jesse98/public/Smokey>. The web site also has an html report for one  
of the System assemblies and a list of all of Smokey's rules.

Changes from Smokey
* Added 23 new rules:
     - AttributeProperties, attributes need getters for required  
arguments and
       getters/setters for optional arguments.
     - AvoidEmptyInterfaces, use attributes instead of tagging types  
with empty
     - CLSCompliant, assemblies should use CLSCompliantAttribute.
     - CompareTo, class implements IComparable but doesn't override  
     - EventHandler, use EventHandler instead of writing event  
delegates yourself.
     - EventSignature, event delegates should use the standard  
delegate signature.
     - ExceptionConstructors, exceptions need constructors for inner  
       and for remoting.
     - HiddenMethod, derived method has a different signature but  
still hides a
       base class method.
     - ImplementGenericCollection, use the generic IEnumerable.
     - NativeMethods, p/invokes should be in a class name NativeMethods,
       SafeNativeMethods, or UnsafeNativeMethods.
     - ObsoleteMessage, ObsoleteAttribute usage doesn't set Message  
     - OverridenFinalizer, don't override finalizers if the base  
class implements
     - PublicAbstractCtor, abstract classes should not have public  
     - SerializeException, exceptions should be serializable.
     - SerializeExceptionMembers, exceptions with fields should override
     - STAThread, main should use STAThreadAttribute.
     - TypedCollection, use the generic ICollection.
     - TypedDictionary, use the generic IDictionary.
     - TypedEnumerator, use the generic IEnumerator.
     - TypedList, use the generic IList.
     - UseBaseTypes, don't pass a derived type into a method if a  
base type will
     - UseFlagsAttribute, enums should use FlagsAttribute where  
     - UseStrongName, assemblies should have strong names.
* Assemblies can now define a DisableRuleAttribute and use it to  
disable rules
   for types and methods in that assembly (see the README for more  
* DisposeNativeResources and DisposableButNoFinalizer check for  
   in addition to IntPtr and UIntPtr.
* BumpBuildNumber.sh is now included in the tarball.

   -- Jesse

More information about the Mono-devel-list mailing list