Friday, December 4, 2009

VSTS Code Analysis Rules for .NET development project

Here is the list of Code Analysis Rules which can be used for any .NET development project.




CA1001
CA1001: Types that own disposable fields should be disposable
CA1009
CA1009: Declare event handlers correctly
CA1016
CA1016: Mark assemblies with AssemblyVersionAttribute
CA1033
CA1033: Interface methods should be callable by child types
CA1049
CA1049: Types that own native resources should be disposable
CA1060
CA1060: Move P/Invokes to NativeMethods class
CA1061
CA1061: Do not hide base class methods
CA1063
CA1063: Implement IDisposable correctly
CA1065
CA1065: Do not raise exceptions in unexpected locations
CA1301
CA1301: Avoid duplicate accelerators
CA1400
CA1400: P/Invoke entry points should exist
CA1401
CA1401: P/Invokes should not be visible
CA1403
CA1403: Auto layout types should not be COM visible
CA1404
CA1404: Call GetLastError immediately after P/Invoke
CA1405
CA1405: COM visible type base types should be COM visible
CA1410
CA1410: COM registration methods should be matched
CA1415
CA1415: Declare P/Invokes correctly
CA1900
CA1900: Value type fields should be portable
CA1901
CA1901: P/Invoke declarations should be portable
CA2000
CA2000: Dispose objects before losing scope
CA2002
CA2002: Do not lock on objects with weak identity
CA2100
CA2100: Review SQL queries for security vulnerabilities
CA2101
CA2101: Specify marshaling for P/Invoke string arguments
CA2108
CA2108: Review declarative security on value types
CA2111
CA2111: Pointers should not be visible
CA2112
CA2112: Secured types should not expose fields
CA2114
CA2114: Method security should be a superset of type
CA2116
CA2116: APTCA methods should only call APTCA methods
CA2117
CA2117: APTCA types should only extend APTCA base types
CA2122
CA2122: Do not indirectly expose methods with link demands
CA2123
CA2123: Override link demands should be identical to base
CA2124
CA2124: Wrap vulnerable finally clauses in outer try
CA2126
CA2126: Type link demands require inheritance demands
CA2136
CA2136: Members should not have conflicting transparency annotations
CA2140
CA2140: Transparent code must not reference security critical items
CA2147
CA2147: Transparent methods may not use security asserts
CA2207
CA2207: Initialize value type static fields inline
CA2212
CA2212: Do not mark serviced components with WebMethod
CA2213
CA2213: Disposable fields should be disposed
CA2214
CA2214: Do not call overridable methods in constructors
CA2216
CA2216: Disposable types should declare finalizer
CA2220
CA2220: Finalizers should call base class finalizer
CA2229
CA2229: Implement serialization constructors
CA2232
CA2232: Mark Windows Forms entry points with STAThread
CA2235
CA2235: Mark all non-serializable fields
CA2236
CA2236: Call base class methods on ISerializable types
CA2237
CA2237: Mark ISerializable types with SerializableAttribute
CA2238
CA2238: Implement serialization methods correctly
CA2240
CA2240: Implement ISerializable correctly
CA2242
CA2242: Test for NaN correctly
CA1000
CA1000: Do not declare static members on generic types
CA1002
CA1002: Do not expose generic lists
CA1020
CA1020: Avoid namespaces with few types
CA1031
CA1031: Do not catch general exception types
CA1051
CA1051: Do not declare visible instance fields
CA1053
CA1053: Static holder types should not have constructors
CA1500
CA1500: Variable names should not match field names
CA1709
CA1709: Identifiers should be cased correctly
CA1726
CA1726: Use preferred terms
CA1804
CA1804: Remove unused locals
CA1811
CA1811: Avoid uncalled private code
CA1820
CA1820: Test for empty strings using string length
CA1822
CA1822: Mark members as static
CA1823
CA1823: Avoid unused private fields
CA2200
CA2200: Rethrow to preserve stack details
CA2201
CA2201: Do not raise reserved exception types
CA1007
CA1007: Use generics where appropriate
CA1011
CA1011: Consider passing base types as parameters
CA1050
CA1050: Declare types in namespaces
CA1054
CA1054: URI parameters should not be strings
CA1055
CA1055: URI return values should not be strings
CA1056
CA1056: URI properties should not be strings
CA1505
CA1505: Avoid unmaintainable code
CA1506
CA1506: Avoid excessive class coupling
CA1800
CA1800: Do not cast unnecessarily
CA1802
CA1802: Use literals where appropriate
CA1814
CA1814: Prefer jagged arrays over multidimensional


No comments:

Post a Comment