code-analysis

phploc output explanation

試著忘記壹切 提交于 2019-12-03 07:53:37
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%) Non-Public: 46 (30.87%) Average Method Length (NCLOC): 9 Cyclomatic Complexity / Number of Methods: 1

FindBugs error: Write to static field from instance method

女生的网名这么多〃 提交于 2019-12-03 07:04:58
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 ? Not a bug 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 bad practice. Firstly it says that it is a bad practice , not incorrect. Second thing is the

Search for commented-out code across files in Eclipse

落爺英雄遲暮 提交于 2019-12-03 06:25:55
Is there a quick way to find all the commented-out code across Java files in Eclipse? Any option in Search, perhaps, or any add-on that can do this? It should be able to find only code which is commented out, but not ordinary comments. Sonar can do it: http://www.sonarsource.org/commented-out-code-eradication-with-sonar/ Scott Merritt In Eclipse, I just do a file search with the regular expression checkbox turned on: (/\*.*;.*\*/)|(//.*;) It will find semicolons in // These; and /* these; */ Works for me. You can mark your own commented code with a task tag. You can create your own task tags

Matlab: how to find functions on path that use a given function

冷暖自知 提交于 2019-12-03 06:07:22
It sometimes happens that I need to change the behavior of a function. Is there an easy way to find functions (on the matlab path) that use that function? The way I do this is to look for files that contain the name of the function I'm interested in. Thus, I don't only see who calls my function, but also what signature they use. In the editor: Edit->Find Files Start with help deprpt . EDIT: when I run a dependency report there are 3 checkboxes at the top of the report window. One of these, by default unchecked, is called 'Show parent functions (current folder only)'. That is probably the

Generate Call-Tree from cscope database

自闭症网瘾萝莉.ら 提交于 2019-12-03 05:55:20
I want to generate Full and Partially Call Trees from cscope database of c and c++ projects in Linux. The project is rather large, so it can be not easy to work with the full call tree of project, so I want to limit call tree generation with grep-like filter of function names. And also I want to be able to build "called by" and "called from" sub-trees from any point. So tool must be interactive and easy to patch. PS: I want use cscope database, because it is already used in project and generating of it is rather fast. I use vim editor and have X windows system. There is cbrowser program on

How to force MSBuild to run Code Analysis without recompiling

柔情痞子 提交于 2019-12-03 05:54:31
By default, code analysis is only done for projects which are compiled. So when I run MSBuild from the command line, it runs code analysis only for the first time. On subsequent calls, code analysis is skipped. Background: I want to evaluate CA rules and see how many warnings there would be in our code when turning on a rule. For that I don't want to recompile everything - which takes some time - but just re-run the code analysis. How can you achieve this? I am using Visual Studio 2013 and MSBuild 12.0. Even explicitely switching on code analysis does not help: msbuild DesktopBuild.proj /p

Any tools to check for duplicate VB.NET code?

陌路散爱 提交于 2019-12-03 05:43:34
I wish to get a quick feeling for how much “copy and paste” coding we have, there are many tools for C# / Java to check for this type of thing. Are there any such tools that work well with VB.NET? (I have seen what looks like lots of repeated code, but wish to get some number to help me make a case for sorting it out) Update on progress. I have just tried Simian. It does not seem to be able to produce a nicely formatted report I can sent by email It does not cope when the names of local variables, or parameters etc may have been changed, e.g it just matches on lines of text being the same.

c/c++ source code browser comparison, seeking opinion [closed]

吃可爱长大的小学妹 提交于 2019-12-03 05:06:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Recently our team inherited a huge code base, about 1 gigabyte c/c++ source codes. The core part (which we may actually modify or update from time to time) is about 650MB and 57,000 files. So I got a perfect test case to see which source code browsers are actually as good as they claim. Following are my test

generic code duplication detection tool

强颜欢笑 提交于 2019-12-03 04:40:46
I'm looking for a code duplication tool that is language agnostic. It's easy to find language specific code duplication tools (for Java, C, PHP, ...), but I'd like to run some code duplication analysis on a templates in a custom syntax. I don't care about advanced parsing of the syntax, just straight line based raw string comparison is fine. Whitespace insensitive matching would be a plus, but not required. (It's not that hard to normalize/eliminate whitespace myself.) Does anybody know a tool that can be (mis)used for something like this? Thanks. Doon Have a look Simian , you can use it for

Tools to detect duplicated code (Java) [closed]

99封情书 提交于 2019-12-03 04:30:35
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am in a project where previous programmers have been copy-pasting codes all over the place. These codes are actually identical (or very similar) and they could have been refactored into one. I have spent countless hours refactoring these codes manually but I think there must be a better way. Some are very