code-analysis

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

僤鯓⒐⒋嵵緔 提交于 2019-12-06 06:54:35
问题 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\

Is it possible to have Code Analysis warnings formatted like normal ones?

允我心安 提交于 2019-12-06 06:49:25
I like the code analysis included in VS2012. But it's a bit annoying that the warnings are only processable in the Code Analysis window, and not by stepping through the build output with F4 . Is there a way to overcome this limitation? How could I format the output of the static code analysis like normal compiler output (i.e. don't only print the filename but the correct path to the file being inspected)? I'm not using FxCop since I'm working with unmanaged code. For unmanaged code analysis, the MSBuild scripts use /analyze:quiet instead of /analyze in order to prevent writing results to the

FxCop behavior in VS2010, Code Analysis, and SuppressMessage

拟墨画扇 提交于 2019-12-06 06:21:04
问题 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

Finding property usage counts with reflection

◇◆丶佛笑我妖孽 提交于 2019-12-06 04:46:49
I have a generated file with around 10,000 public static properties and methods. I suspect that a nontrivial number of them are entirely unused, but there are around 50 assemblies and millions of lines of code to check to be sure. What I would like to do is run some kind of utility that can look into all of the compiled assemblies we have and tell me exactly which members of this class are being called, and give me counts for each one. Is such a thing possible with reflection, or do I need to revert to actual code analysis tools? Are there any libraries that can analyze assemblies to find

Analysing FxCop / Code Analysis warning CA1506: AvoidExcessiveClassCoupling

房东的猫 提交于 2019-12-06 03:19:45
问题 I'm getting Visual Studio Code Analysis warning CA1506 for a C# class. It says, "'FormMain' is coupled with 93 different (non-IComponent) types from 25 different namespaces. Rewrite or refactor this class's methods to decrease its class coupling, or consider moving some of the class's methods to some of the other types it is tightly coupled with. A class coupling above 95 indicates poor maintainability, a class coupling between 95 and 80 indicates moderate maintainability, and a class

VS2010 code analysis. Suppress message CA1051:DoNotDeclareVisibleInstanceFields for all class members

久未见 提交于 2019-12-06 03:10:56
问题 I have a class like this one: public class Foo { public readonly int A = 1; public readonly int B = 2; } When I run VS2010 built in Code Analysis tool, I get 2 identical warnings: that ' field '...' is visible outside of its declaring type, change its accessibility to private and add a property, with the same accessibility as the field has currently, to provide access to it '. I want to suppress this warning for all fields in my class Foo , but I don't want to mark every field with

Test case for Insertion Sort, MergeSort and Quick Sort

本秂侑毒 提交于 2019-12-06 02:49:11
问题 I have implemented (in Java) Insertion Sort, MergeSort, ModifiedMergeSort and Quick Sort: ModifiedMergeSort has a variable for the "bound" of elements. When the elements to be sorted are less than or equal to "bound" then use Insertion Sort to sort them. How come Version 1 is better than Versions 3, 4 and 5? Are the results for Versions 2 and 6 realistic? Here is my results (In Milliseconds): Version 1 - Insertion Sort: Run-Times over 50 test runs Input Size Best-Case Worst-Case Average-Case

Parsing Classes, Functions and Arguments in PHP

一笑奈何 提交于 2019-12-06 02:23:46
问题 I want to create a function which receives a single argument that holds the path to a PHP file and then parses the given file and returns something like this: class NameOfTheClass function Method1($arg1, $arg2, $arg2) private function Method2($arg1, $arg2, $arg2) public function Method2($arg1, $arg2, $arg2) abstract class AnotherClass function Method1($arg1, $arg2, $arg2) private function Method2($arg1, $arg2, $arg2) public function Method2($arg1, $arg2, $arg2) function SomeFunction($arg1,

List global variables in a C program

故事扮演 提交于 2019-12-05 22:37:34
问题 Is there a tool around that will list all the global variables in a C program? More specifically, is there a simple commandline tool that will do this, i.e. not a heavyweight IDE, CASE, graphical toolkit system etc., but just something that can be run like foo *.c ? 回答1: If you happen to compile the file on most unixes you have nm that just lists you all linker symbols. These symbols are classified in different groups (a bit platform dependent) so you should easily find out which the

How to exclude a directory from the code analysis?

只谈情不闲聊 提交于 2019-12-05 18:35:30
There have been some questions about this, but none of them solves my problem. I use SonarQube to do code analysis on one of my projects, which contain a Migrations directory. I would like to exclude all the source files in that directory from the code analysis. In the projects Configuration->Settings->Exclusions->Files->Source Files Exclusions I added "**/Migrations/ . " , but in the analysis results I still get issues in code files in that directory. The directory structure of my project looks like this: \MyProject\Migrations\SourceFile.cs What am I doing wrong? Am I entering the wildcard in