code-analysis

FxCop and Code Analysis Rules

你。 提交于 2019-12-04 23:19:56
问题 I recently started using Code Analysis on my projects in Visual Studio. I have created a custom ruleset to use with all of my projects that include two of the Microsoft defined rulesets. I've been working to integrate FxCop into the CI build process to fail builds that don't pass all rules. What's really odd to me is that I can't use my ruleset to define what rules FxCop scans the code against. How do I make it so Visual Studio's Code Analysis rules match up to FxCop's rules? 回答1: You already

Disabling/Fixing Code Analysis warnings from .Designer.cs files

落花浮王杯 提交于 2019-12-04 17:09:13
问题 I am using DataVisualization.Charting.Chart extensively, and for the most part it is working. However, I've been running Code Analysis frequently, and have all my own warnings taken care of. But, there are about 30 CA2000 (object not disposed along all exception paths) in the *.Designer.cs files that use the charting. The Designer files are generating pretty much all the charting code, and almost all the charting elements implement IDisposable . I have "Suppress results from generated code"

Find “Dead code”

走远了吗. 提交于 2019-12-04 14:51:31
问题 I am trying to find private methods that are not called from any other code (CA1811) https://msdn.microsoft.com/en-us/library/ms182264(v=vs.110).aspx, with Visual Studio 2012 Code Analysis buy it doesn't detect it, despite putting the project code analysis rule set in " all rules ". This is possible? In this case, how can I configure my project solution? In case of installing any extension, I will prefer that it was free. Thanks! 回答1: The rule CA1811: Avoid uncalled private code perfectly

MATLAB: determine dependencies from 'command line' excluding built in dependencies

时光毁灭记忆、已成空白 提交于 2019-12-04 14:40:42
Is there a way to determine all the dependencies of an .m file and any of the dependencies of the files it calls using a command in a script (command-line)? There was a question like this before and it was really good because it suggested using the depfun function. BUT the issue with this was that it is outputting the MATLAB related files that it depends on as well. EXAMPLE: testing.m disp('TESTING!!'); The output of depfun('testing') 'C:\testing.m' 'C:\MATLAB\R2008a\toolbox\matlab\datatypes\@opaque\char.m' 'C:\MATLAB\R2008a\toolbox\matlab\datatypes\@opaque\double.m' 'C:\MATLAB\R2008a\toolbox

Visual Studio 2012 Express Code Analysis

烈酒焚心 提交于 2019-12-04 13:40:17
The Microsoft documentation talks about a limited set of code analysis tools being available for the express edition (e.g. Microsoft Visual Studio Blog ). I am using VS 2012 update 3, and can not see any code analysis options in context menus, or any buttons or menu options. I am pretty sure I ran some code analysis at some point, but that might have been before update 2 was installed. Does anyone know if this option has been removed from more recent express editions, and if not where I can find the appropriate menu item or settings to be able to run and view the results of code analysis. Edit

Critiquing PHP-code / PerlCritic for PHP?

只谈情不闲聊 提交于 2019-12-04 13:11:38
I'm looking for an equivalent of PerlCritic for PHP. PerlCritc is a static source code analyzer that qritiques code and warns about everything from unused variables, to unsafe ways to handle data to almost anything. Is there such a thing for PHP that could (preferably) be run outside of an IDE, so that source code analysis could be automated? Not sure I've ever heard about a PHP tool that would do all that... But a couple of existing QA-related tools, that might help you at least a bit, would be : PHPMD - PHP Mess Detector -- might actually be the best choice for you, if you consider the set

Tools and best practices to understand somebody else's code [closed]

拜拜、爱过 提交于 2019-12-04 12:28:39
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Sometimes one needs to dig into someone else's code, understand it and maybe refactor/fix it. So I'm wondering what tools/practices do you use to do that? It's not about any specific language or platform, rather some advises in general. I myself find it very useful to run the

How do I find all the unit tests that may directly or indirectly call a given method? (.net)

不打扰是莪最后的温柔 提交于 2019-12-04 12:18:23
How do I find all the unit tests that may directly or indirectly call a given method? When I change a method, I wish to know the best tests to run; there must be a tool for this! As we have lots of interfaces, I am interested in all unit tests that calls a method on an interface when there is at least one path var the implantation method on a class that implements the interface. Or in other words, I want a list of all unit tests when the tool cannot prove the result is not affected by the method I have changed. (We are using nUnit on .net and have lots of slow unit tests, it will be many year

FindBugs error: Write to static field from instance method

那年仲夏 提交于 2019-12-04 12:15:42
问题 I have couple of areas in my application where I get the error while manipulating value of static variable from instance method. "Write to static field from instance method" . If we take multi-threading out of the equation, does this scenario pose any potential issue even if multiple instances write to the same static variable ? 回答1: From the documentation... This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally

FxCop behavior in VS2010, Code Analysis, and SuppressMessage

人盡茶涼 提交于 2019-12-04 11:28:05
I have a class like this one: [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Io")] public void ParaQueFalleCalidadCodigoUnoIo_ReglaCA1709() { } public void ParaQueFalleCalidadCodigoDosIo_ReglaCA1709() { } I use a custom Ruleset file CustomRules.ruleset <RuleSet Name="RulesNet" ToolsVersion="10.0"> <RuleHintPaths> <Path>C:\Fxcop10.0\Rules</Path> </RuleHintPaths> <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed"> <Rule Id="CA1709" Action="Warning" /> </Rules> </RuleSet