static-analysis

phploc output explanation

馋奶兔 提交于 2020-01-22 12:32:06
问题 If I run phploc against one of my PHP project (open source) I see this output. phploc 1.6.4 by Sebastian Bergmann. Directories: 3 Files: 33 Lines of Code (LOC): 2358 Cyclomatic Complexity / Lines of Code: 0.08 Comment Lines of Code (CLOC): 903 Non-Comment Lines of Code (NCLOC): 1455 Namespaces: 0 Interfaces: 3 Classes: 28 Abstract: 1 (3.57%) Concrete: 27 (96.43%) Average Class Length (NCLOC): 49 Methods: 149 Scope: Non-Static: 128 (85.91%) Static: 21 (14.09%) Visibility: Public: 103 (69.13%)

phploc output explanation

亡梦爱人 提交于 2020-01-22 12:31:28
问题 If I run phploc against one of my PHP project (open source) I see this output. phploc 1.6.4 by Sebastian Bergmann. Directories: 3 Files: 33 Lines of Code (LOC): 2358 Cyclomatic Complexity / Lines of Code: 0.08 Comment Lines of Code (CLOC): 903 Non-Comment Lines of Code (NCLOC): 1455 Namespaces: 0 Interfaces: 3 Classes: 28 Abstract: 1 (3.57%) Concrete: 27 (96.43%) Average Class Length (NCLOC): 49 Methods: 149 Scope: Non-Static: 128 (85.91%) Static: 21 (14.09%) Visibility: Public: 103 (69.13%)

Sonar to display results generated by FxCop

半世苍凉 提交于 2020-01-15 15:36:41
问题 How can I use Sonar to display results of the output produced by FxCop. I used FxCop to run static code analysis on .NET Project and FxCop generate the result report in an XML format. Can I use Sonar to take this XML file an input and display the output with it? How can this be done? I am looking for an open source dash board tool to present the output the result produced by FxCop to the end user. 回答1: Sonar has a C# plug-in, documented here: http://docs.codehaus.org/display/SONAR/C-Sharp

Sonar to display results generated by FxCop

眉间皱痕 提交于 2020-01-15 15:36:12
问题 How can I use Sonar to display results of the output produced by FxCop. I used FxCop to run static code analysis on .NET Project and FxCop generate the result report in an XML format. Can I use Sonar to take this XML file an input and display the output with it? How can this be done? I am looking for an open source dash board tool to present the output the result produced by FxCop to the end user. 回答1: Sonar has a C# plug-in, documented here: http://docs.codehaus.org/display/SONAR/C-Sharp

How to exclude folders from c++ core guidelines checkers check path?

此生再无相见时 提交于 2020-01-14 08:26:37
问题 My problem is that the Nuget packages (inside solutions /packages folder) are causing a lot of warnings and analyzing them is taking ages. I have tried excluding folders from static analysis with no success. I have an understanding that this would be achieved using a CAExcludePath enviroment variable. But where should I set the CAExcludePath environment variable? I have already tried setting it through project->debugger->environment field. 回答1: The variable is accessible in C:\Program Files

Weird false-positive of javac data flow analysis

血红的双手。 提交于 2020-01-13 13:54:35
问题 I have code of the following form: class Test { private final A t; public Test() { for ( ... : ... ) { final A u = null; } t = new A(); } private class A {} } Compiler says: variable t might already have been assigned Interestingly, if I perform any of the following changes to the loop it works out! Change the loop's content to A u = null Remove the loop (but keep final A u = null; ) Replace the foreach-style loop with a classic counting loop What is going on here? Note: I could not get the

Weird false-positive of javac data flow analysis

一笑奈何 提交于 2020-01-13 13:53:45
问题 I have code of the following form: class Test { private final A t; public Test() { for ( ... : ... ) { final A u = null; } t = new A(); } private class A {} } Compiler says: variable t might already have been assigned Interestingly, if I perform any of the following changes to the loop it works out! Change the loop's content to A u = null Remove the loop (but keep final A u = null; ) Replace the foreach-style loop with a classic counting loop What is going on here? Note: I could not get the

C# Static Analysis, possible values for a variable/parameter

拥有回忆 提交于 2020-01-12 03:24:07
问题 In code similar to each of the following examples, I would like to be able to statically analyze code to determine the list of possible values that are passed into SpecialFunction(). SpecialFunction(5); // A int x = 5; SpecialFunction(x); // B int x = 5; x = condition ? 3 : 19; SpecialFunction(x); // C I can already parse the C# into an abstract syntax tree and I can already handle cases like A, and I guess I could keep track of initial assignments of values to guess case B, but cases as easy

Instance variables with underscore in Objective-C 2.0 and renaming with @synthetize leads to optimization warnings by the 'Analyze' tool of Xcode 4 [duplicate]

自古美人都是妖i 提交于 2020-01-08 18:01:31
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How does an underscore in front of a variable in a cocoa objective-c class work? I'm using the same convention for instance variable and properties naming as shown by sebnow in his following answer: instance variable/ method argument naming in Objective C I copy paste his example code here: @interface Foo : NSObject { id _bar; } @property (nonatomic, retain) id bar; - (id) initWithBar:(id)aBar; @end

Is it possible to create a “Positive Number” type in Swift?

白昼怎懂夜的黑 提交于 2020-01-07 03:06:40
问题 Sorry if this is a stupid question but I'm wondering if there's a way in Swift to create a type that exclusively holds numbers that are strictly greater than zero and where the "positiveness" of the values is enforced at compile time. For example, can I create somehow write code like func divide(x: PositiveNumber, y: PositiveNumber){ return x / y } such that divide(1, 3) works but divide(1, 0) won't compile? The closest thing I could come up with was a struct with only one fallible