What static analysis tools are available for C#? [closed]

Code violation detection Tools: FxCop, excellent tool by Microsoft. Check compliance with .NET framework guidelines. Edit October 2010: No longer available as a standalone download. It is now included in the Windows SDK and after installation can be found in Program Files\Microsoft SDKs\Windows\ [v7.1] \Bin\FXCop\FxCopSetup.exe Edit February 2018: This functionality has now been integrated into … Read more

How can I perform static code analysis in PHP? [closed]

Run php in lint mode from the command line to validate syntax without execution: php -l FILENAME Higher-level static analyzers include: php-sat – Requires http://strategoxt.org/ PHP_Depend PHP_CodeSniffer PHP Mess Detector PHPStan PHP-CS-Fixer phan Lower-level analyzers include: PHP_Parser token_get_all (primitive function) Runtime analyzers, which are more useful for some things due to PHP’s dynamic nature, include: … Read more

CA2202, how to solve this case

You should suppress the warnings in this case. Code that deals with disposables should be consistent, and you shouldn’t have to care that other classes take ownership of the disposables you created and also call Dispose on them. [SuppressMessage(“Microsoft.Usage”, “CA2202:Do not dispose objects multiple times”)] public static byte[] Encrypt(string data, byte[] key, byte[] iv) { … Read more

What’s with the integer cache maintained by the interpreter?

Python caches integers in the range [-5, 256], so integers in that range are usually but not always identical. What you see for 257 is the Python compiler optimizing identical literals when compiled in the same code object. When typing in the Python shell each line is a completely different statement, parsed and compiled separately, … Read more