code-metrics

How is SLOC counted by Delphi IDE?

主宰稳场 提交于 2019-12-11 02:52:41
问题 You see pretty often here people saying that they have a x million of lines of code project. How is this measured? Is this number, the number shown under 'Information' menu? The manual says that only the compilable lines are counted (so, without comments and empty lines): Source compiled -> Displays total number of lines compiled. But the manual doesn't explain how a piece of code as if/then/else is counted: if B=true then for i:= 0 to 100 do Stuff else ; Is every line that has a blue dot is

Does using a map truly reduce cyclomatic complexity?

ε祈祈猫儿з 提交于 2019-12-10 20:11:43
问题 Suppose I have the original method below. public String someMethod(String str) { String returnStr; if("BLAH".equals(str)) { returnStr="ok"; } else if ("BLING".equals(str)) { returnStr="not ok"; } else if ("BONG".equals(str)) { returnStr="ok"; } return returnStr; } Does converting to below truly reduce CC? Map<String, String> validator = new HashMap<String,String>(); validator.put("BLAH","ok"); validator.put("BLING","not ok"); validator.put("BONG","ok"); public String someMethod(String str) {

How to find out how many lines of code there are in an Xcode project?

ぐ巨炮叔叔 提交于 2019-12-10 12:38:03
问题 Is there a way to determine how many lines of code an Xcode project contains? I promise not to use such information for managerial measurement or employee benchmarking purposes. ;) 回答1: Check out CLOC. cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. (Legacy builds are archived on SourceForge.) 回答2: I see this floating around and use it myself: find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.swift" ")" -print0 |

What would be a good way to measure the size of a JSP project?

依然范特西╮ 提交于 2019-12-10 10:12:02
问题 Given an existing JSP project, I would like to get a feel for the complexity/size of the "view" portion of the project. Here's what I've done so far: Pulled the list of JSP's that have been compiled from the production server within the last x months (that eliminates 'dead' jsps). Wrote a quick scanner to find the JSP fragment files that are imported into the compiled pages. Pulled the size of the file and the timestamp off the file system. So now I have a list of pages and the fragments

How can the cyclomatic complexity be 27 in a method with 13 event handler subscriptions?

落爺英雄遲暮 提交于 2019-12-09 16:52:12
问题 We have this code, sortof: private void InitializeEvents() { this.Event1 += (s,e) => { }; this.Event2 += (s,e) => { }; this.Event3 += (s,e) => { }; this.Event4 += (s,e) => { }; this.Event5 += (s,e) => { }; this.Event6 += (s,e) => { }; this.Event7 += (s,e) => { }; this.Event8 += (s,e) => { }; this.Event9 += (s,e) => { }; this.Event10 += (s,e) => { }; this.Event11 += (s,e) => { }; this.Event12 += (s,e) => { }; this.Event13 += (s,e) => { }; } Code analysis in VS10 Ultimate says "cyclomatic

What is Abstractness vs. Instability Graph?

瘦欲@ 提交于 2019-12-09 14:25:40
问题 I recently used NDepend and it produced a good report on my .net assemblies and related pdbs. The most interesting thing I found in the report was abstractness vs. instability graph. I wanted to understand this in real detail, I read their docs and online metrices but it could only help to an extent. Primarily I wish to understand how to evaluate the graph correctly and techniques to control abstractness with stability. There's a very good article here that talks on this but what more in

How can I visualize changes in a large code base quality?

偶尔善良 提交于 2019-12-07 00:02:23
问题 One of the things I’ve been thinking about a lot off and on is how we can use metrics of some kind to measure change, are we going backwards or not? This is in the context of a large, legacy code base which we are improving. Most of the code is C++ with a C heritage. Some new functions and the GUI are written in C#. To start with, we could at least be checking if the simple complexity level was changing over time in the code. The difficulty is in having a representation – we can maybe do a 3D

Is there a standard way to count statements in C#

我怕爱的太早我们不能终老 提交于 2019-12-06 06:47:19
问题 I was looking at some code length metrics other than Lines of Code. Something that Source Monitor reports is statements. This seemed like a valuable thing to know, but the way Source Monitor counted some things seemed unintuitive. For example, a for statement is one statement, even though it contains a variable definition, a condition, and an increment statement. And if a method call is nested in an argument list to another method, the whole thing is considered one statement. Is there a

How to extract a single function from a source file

筅森魡賤 提交于 2019-12-05 18:44:15
I'm working on a small academic research about extremely long and complicated functions in the Linux kernel . I'm trying to figure out if there is a good reason to write 600 or 800 lines-long functions. For that purpose, I would like to find a tool that can extract a function from a .c file, so I can run some automated tests on the function. For example, If I have the function cifs_parse_mount_options() within the file connect.c , I'm seeking a solution that would roughly work like: extract /fs/cifs/connect.c cifs_parse_mount_options and return the 523 lines of code(!) of the function, from

How can I visualize changes in a large code base quality?

廉价感情. 提交于 2019-12-05 04:59:47
One of the things I’ve been thinking about a lot off and on is how we can use metrics of some kind to measure change, are we going backwards or not? This is in the context of a large, legacy code base which we are improving. Most of the code is C++ with a C heritage. Some new functions and the GUI are written in C#. To start with, we could at least be checking if the simple complexity level was changing over time in the code. The difficulty is in having a representation – we can maybe do a 3D surface where a 2D map represents the code and we have a heat-map of color representing complexity