[Mono-announce-list] [ANN] Smokey 1.4 - assembly checker

Jesse Jones jesjones at mindspring.com
Mon Oct 20 03:46:36 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 233 rules.

Changes from Smokey 1.3.0.0:
* Added nineteen new rules:
    - BaseDisposable, should have Dispose(bool) method.
    - ConfusingDispose, not IDisposable but has Dispose method.
    - ConstantResult, Equals, GetHashCode, or relational operator  
always returns a constant.
    - DerivedDisposable, Dispose(bool) should call base, don't have a  
finalizer.
    - Disposable, checks for eleven problems including improper  
naming, a Dispose method throwing, and Dispose(bool) using a field  
without a null check.
    - EqualsMissesState, Equals does not check a field exposed by a  
trivial get/set property.
    - Finalizeable, empty, throws, or not IDisposable.
    - HashButNoEquals, overrides GetHashCode, but not Equals.
    - InvalidEnumFlags, marked as flags but all values are sequential.
    - ISerializableMethods, not ISerializable but has  
(SerializationInfo, StreamingContext) ctor.
    - MutableField, externally visible field is readonly, mutable, and  
not a value type.
    - PreferSafeHandle, has a finalizer and an IntPtr field.
    - RedundantOperand, selected binary operator or method is invoked  
but both arguments are computed using identical code.
    - SerializableAttribute, exception class is not marked with  
SerializableAttribute.
    - ThreadAbort, Thread.Abort was called.
    - ThreadName, thread was instantiated but not given a name.
    - ThreadSafeAttr, thread root was not marked with  
ThreadRootAttribute/ThreadSafeAttribute, or method called from  
multiple threads was not marked with ThreadSafeAttribute.
    - UseIEquatable, defines Equals but isn't IEquatable<T>.
    - VisiblePointer, externally visible IntPtr field is not readonly.
* Removed some rules (these have been folded into the new more general  
disposable rules):
    - BaseDisposable
    - DisposeFields
    - EmptyFinalizer
    - IDisposableWithoutSuppressFinalize
    - NoObjectDisposedException
    - OverridenFinalizer
* Removed DisposableButNoFinalizer rule (DisposeNativeResources  
handles it).
* Removed ignoreList setting (use dictionary setting instead).
* Write a message to stderr if aspell isn't installed (instead of  
reporting a bug in smokey).
* GodClass rule fires for over 60 types instead of over 40 types.
* Smokey now does a better job resolving generic types.
* File and line numbers are now retrieved using Cecil instead of the  
undocumented Mono.CompilerServices.SymbolWriter, atlhough Cecil  
doesn't seem to be as accurate as the old code.
* Lot's of minor bug fixes, including fixes for automatic properties  
and mono 2.0.

  -- Jesse



More information about the Mono-announce-list mailing list