code-analysis

Perl Challenge - Directory Iterator

只愿长相守 提交于 2019-12-07 05:21:28
问题 You sometimes hear it said about Perl that there might be 6 different ways to approach the same problem. Good Perl developers usually have well-reasoned insights for making choices between the various possible methods of implementation. So an example Perl problem: A simple script which recursively iterates through a directory structure, looking for files which were modified recently (after a certain date, which would be variable). Save the results to a file. The question, for Perl developers:

CA1001 Visual Studio 2012 Code Analysis warning. What does it mean?

谁说胖子不能爱 提交于 2019-12-07 02:15:02
问题 It is not that important but I am trying to figure out what it is telling me and is it a legitimate warning ? Can someone explain this error in simple terms for me ? CA1001 Types that own disposable fields should be disposable Implement IDisposable on 'MemVoteManager' because it creates members of the following IDisposable types: 'CongressDBEntities'. If 'MemVoteManager' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to

Code analysis in F#

浪子不回头ぞ 提交于 2019-12-07 02:03:09
问题 As a C# developer I've benefited from Microsoft's Code Analysis. In F# however, Code Analysis doesn't seem to be an integrated part of the development cycle. It took me a while to enable CA on an F# project, but this blog helped. Now that I have CA enabled, it seems to produce "wrong" warnings. For instance, I have a declared a record type as type Account = {Number : string} for which I expect structural equality by default. This blog demonstrates that two instances of type Acccount, for

Proper way to define the schema for 'CustomDictionary.xml' in Visual Studio (2013)?

我的梦境 提交于 2019-12-07 01:19:45
问题 I'm making use of a custom dictionary (CustomDictionary.xml) for Code Analysis, and it is working like it should. But, I keep getting warnings that indicate to me that the XML file is not defining its XSD schema location properly: I found the XSD ( CustomDictionary.xsd ) on my machine, and I specified the scheme of its URI as type file : file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2012.0/Team%20Tools/Static%20Analysis%20Tools/Schemas/CustomDictionary.xsd With this URI,

Specifying code analysis setting in TFS 2010 build

做~自己de王妃 提交于 2019-12-07 00:14:32
In the build definition of TFS 2010, when "Perform Code Analysis" set to "Always" how can I specify a custom code analysis rules file? The build flavour is "Release". I prefer not to set "AsConfigured" for "Perform Code Analysis" so that the settings are picked from proj file. Thanks. You should be able to use the "MSBuild Arguments" entry in your build process parameters configuration to provide a /property command line entry that will be passed to MSBuild, thereby allowing override of the CodeAnalysisRuleSet property value to be applied. Depending on how you have set up the

What is the best way to cleanup the resources used by a Crystal Reports ReportDocument object?

喜欢而已 提交于 2019-12-06 19:14:03
问题 I am working on an application that uses Crystal Reports for the reporting. It opens a given report in a ReportDocument object, does what it needs to do and then closes the report. using (var report = OpenReport(reportSourceInfo)) { // Do stuff with the report report.Close(); } The OpenReport method does some validation of the source file and returns an open ReportDocument object. Testing has shown that this code does what it's meant to do and appears to have no issues. The problem I'm really

“CA2000: Dispose object before losing scope” building Unity container

北城以北 提交于 2019-12-06 14:50:01
I am using following code where I am getting fxCop voilation CA2000: Dispose object before losing scope: private static IUnityContainer BuildContainer() { var container = new UnityContainer().LoadConfiguration(); return container; } to remove this violation I have used following code: private static IUntyContainer BuildContainer() { using(var container = new UnityContainer()) { return container.LoadConfiguration(); } } But this code start throwing exception while resolving dependencies. Can someone help me with this? This violation usually stems from a couple of code patterns though you should

Find code that depends on .NET 3.5 SP1

孤街浪徒 提交于 2019-12-06 13:36:27
Is there a way to run some sort of code analysis to find code which will compile with .NET 3.5 SP1 but not 3.5 RTM? FxCop works for assemblies introduced with SP1, but for code that simply calls new methods and properties it does not detect that usage. Sam Saffron Sure, you can highlight this stuff with fxcop or VS team system. Make sure you have a read this answer . There is a bug with the current rules that ship with fxcop, so you need to do a bit of hand holding to get it to work. 来源: https://stackoverflow.com/questions/640057/find-code-that-depends-on-net-3-5-sp1

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

谁说胖子不能爱 提交于 2019-12-06 08:55:45
问题 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

Critiquing PHP-code / PerlCritic for PHP?

做~自己de王妃 提交于 2019-12-06 08:13:49
问题 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? 回答1: 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,