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: <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 0.6.0.0: * Added 35 new rules: BaseSerializable1, missing call to base class serialization constructor. BaseSerializable2, missing call to base class GetObjectData. BeforeEvent, name of an event starts with "Before" or "After". BoolMarshaling, p/invoke method has a bool return type or bool argument type that does not have a MarshalAsAttribute. CastOpAlternative, type defines a cast operator to Foo but does not have ToFooType and FromFooType methods. Const1, field is declared static readonly and is initialized with a value that can be computed at compile time. DataLocale, a System.Data.DataTable or System.Data.DataSet was created, but Locale property was not set. DeclareSecurity, the assembly does not specify security permissions. DeepInheritance, a class has more than four (non Object) super classes in its inheritance hierarchy. DefaultExceptionCtor, a System.ArgumentException, System.ArgumentNullException, System.ArgumentOutOfRangeException, or System.DuplicateWaitObjectException is default constructed. EqualityOperator, a value type overrides Equals, but does not define operator== and operator!=. ImplicitCast, a type defines an implicit cast operator. InlineStaticInit, a reference type declares an explicit static constructor. MessageBoxOptions, a method calls System.Windows.Forms.MessageBox.Show without specifying MessageBoxOptions. NanTest, an equality or inequality operator operand is System.Single.NaN or System.Double.NaN. NonSerializableField, an instance field of a System.SerializableAttribute type is not serializable and not marked with System.NonSerializedAttribute. NoSerializableAttribute, an externally visible type implements System.Runtime.Serialization.ISerializable, but is not marked with System.SerializableAttribute. NotInstantiated, an instantiable non-public type is never instantiated. OperatorAlternative, an externally visible type defines an operator, but does not define a named alternative method. OptionalSerialization, a field is decorated with OptionalFieldAttribute, but no method in the declaring type is decorated with OnDeserializingAttribute or OnDeserializedAttribute. PreferredTerm, a externally visible type, method, or argument name contains an obsolete term. PublicType, the assembly is an application (i.e. it has a main entry point), but also has a public type. RequireSerializableCtor, the type implements System.Runtime.Serialization.ISerializable but does not implement the (SerializationInfo, StreamingContext) constructor. SerializableCtorAccess, a (SerializationInfo, StreamingContext) constructor has the wrong access level. SerializableMethods, a method decorated with a Serialization attribute has the wrong signature. SortedMethods, a classes methods are only mostly sorted. SpecialFolder, a string literal is using a special folder path. StringCompare, a string is compared to an empty string using Equals or operator==. SuffixName, a type name does not have the correct suffix (e.g. Attribute, EventArgs, Collection, etc). SuffixName2 a type name is using a reserved suffix (e.g. Attribute, EventArgs, Collection, etc). SuffixName3, a type name has suffix which should not be used (e.g. Delegate, Enum, Flags). TempDir, a string literal contains a path that starts with "/var/ tmp", "/tmp", or "C:\Windows\Temp". UnsealedAttribute, a public type inherits from System.Attribute, is not abstract, and is not sealed. UnusedMethod, a private or internal method is never called. * Only check .Net 2.0 related rules if the assembly is targeting .Net 2.0 or above. * We now get a file name for a type if the type has constructors but no methods. * Instead of loading just the assembly being checked we now load all of the dependant assemblies which makes life easier for us and allows us to do a bit better job in some of the rules. * Instead of checking for base class finalizers DisposeNativeResourcesRule checks for overriden Dispose methods. * BaseDisposableRule checks for any base Dispose call instead of just the immediate base. * AttributePropertiesRule ignores public fields. * Updated EqualsRequiresNullCheck1 description to point out that it also fires for infinitely recursive equals methods. * Use "V_n" if MethodEntry.LocalNamesAmbiguous. * Allow logging to stdout and stderr. -- Jesse _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
