Klocwork Quality Standard C# checker reference

List of community C# checkers that focus on improving overall code quality. To view this information organized by rule number, see Klocwork Quality Standard mapped to Klocwork community C# checkers.

Checker name Description Default severity Enabled by default? Version
CS.BANNED.CONSOLE_WRITE Avoid System.Console 'Write()' or 'WriteLine()' statements 4 False 2020.1
CS.BANNED.GC_COLLECT Do not explicitly call 'System.GC.Collect()' or 'System.GC.Collect(int)' 4 False 2020.1
CS.BANNED.INVOKE Prefer asynchronous calls to synchronized calls 4 False 2020.1
CS.BANNED.PARSE Do not use Parse 4 False 2020.1
CS.BOXING Avoid boxing/unboxing when possible 4 False 2020.1
CS.DB.CLOSE.FINALLY Close data base connections in 'finally' block 4 False 2020.1
CS.EXCEPT.NO_LOG Ensure all exceptions are either logged with a standard logger or rethrown 4 False 2020.1
CS.EXCEPT.RETHROW Avoid clearing stack trace while rethrowing exceptions 4 False 2020.1
CS.EXPR.EQ.STR Use String.IsNullOrEmpty to check if a string is null or empty 4 False 2020.1
CS.IDISP.DISPOSE Implement Dispose(bool) as a virtual method if IDisposable is implemented 4 False 2020.1
CS.IDISP.DTOR Provide a destructor (finalizer) when you implement IDisposable 4 False 2020.1
CS.IDISP.USING Using statement should be used for constructing objects that implement IDisposable 4 False 2020.1
CS.LA_UNUSED Unused label 4 False 2020.1
CS.LV_UNUSED.GEN Unused local variable 4 False 2020.1
CS.MAGIC.CHAR Magic number used: char 4 False 2020.1
CS.MAGIC.NUMBER Magic number used: number 4 False 2020.1
CS.MAGIC.STRING Magic number used: string 4 False 2020.1
CS.MEMB.NOT_SERIALIZABLE Ensure entire graph of object can be serialized 4 False 2020.1
CS.METHOD.EMPTY Avoid empty methods 4 False 2021.2
CS.METHOD.NEW Avoid use of new keyword for hiding methods 4 False 2020.1
CS.METHOD.RETURN.REF_MEMBER Member variable with reference type returned in method 4 False 2020.1
CS.METHOD.STRUCT.NO_REF_OUT Method parameter with struct type has no ref or out specifier 4 False 2020.1
CS.METHOD.UNUSED_PRIVATE Avoid unused private methods 4 False 2021.2
CS.PROP.LOCK Lock both when either set or get is locked for a property 4 False 2020.1
CS.STMT.CONTROL.EMPTY Avoid control statements with empty bodies 4 False 2020.1
CS.STMT.DO.BLOCK Body for do statement should be a block 4 False 2020.1
CS.STMT.FOR.BLOCK Body for for statement should be a block 4 False 2020.1
CS.STMT.IFELSE.BLOCK Body for If/Else statement should be a block 4 False 2020.1
CS.STMT.WHILE.BLOCK Body for while statement should be a block 4 False 2020.1
CS.SV.CRITICAL_CONST Security critical constants should be transparent 4 False 2020.1
CS.SV.CRITICAL_LVL Types must be at least as critical as their base types and interfaces 4 False 2020.1
CS.SV.EXPOSED_FIELD Secured types should not expose fields 4 False 2020.1
CS.SV.HIDDEN_FORM Avoid using hidden form fields to store content with potential security impact 4 False 2020.1
CS.SV.LINK_DEMAND.INHERITANCE Type link demands require inheritance demands 4 False 2020.1
CS.SV.LINK_DEMAND.LEVEL2 Level 2 assemblies should not contain LinkDemands 4 False 2020.1
CS.SV.LINK_DEMAND.TRANSP Transparent code should not be protected with LinkDemands 4 False 2020.1
CS.SV.SER_CTOR Secure serialization constructors 4 False 2020.1
CS.SV.SQL_QUERY Review SQL queries for security vulnerabilities 4 False 2020.1
CS.SV.TRANSP.ASSEMBLY_LOAD Transparent code should not load assemblies from byte arrays 4 False 2020.1
CS.SV.TRANSP.ASSERT Transparent methods may not use security asserts 4 False 2020.1
CS.SV.TRANSP.CONFLICT Members should not have conflicting transparency annotations 4 False 2020.1
CS.SV.TRANSP.HPCE Transparent methods may not use the HandleProcessCorruptingExceptions attribute 4 False 2020.1
CS.SV.TRANSP.SEC_DMD Transparent methods should not use security demands 4 False 2020.1
CS.SV.TRANSP.SUCSA Transparent methods should not be decorated with the SuppressUnmanagedCodeSecurityAttribute 4 False 2020.1
CS.SV.TYPE_EQVL Security critical types may not participate in type equivalence 4 False 2020.1
CS.SWITCH.DEFAULT.POSITION Default label does not appear as the first or the last label in switch statement 4 False 2020.1
CS.SWITCH.NODEFAULT Provide 'default:' for each 'switch' statement 4 False 2020.1
CS.UNINIT.LOCAL_VAR Uninitialized local variable 4 False 2020.1
CS.UNINIT.LOOP_COUNTER Uninitialized loop counter in for statement 4 False 2020.1