code-metrics

Is there a standard way to count statements in C#

这一生的挚爱 提交于 2019-12-04 12:35:08
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 standard way that statements are counted and are their rules governing such a thing? The closest you might

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

ぐ巨炮叔叔 提交于 2019-12-04 04:49:36
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 complexity of 27". Removing one of the lines makes the cyclomatic complexity 25. There's no branching going

Source of parsers for programming languages?

送分小仙女□ 提交于 2019-12-04 03:15:56
I'm dusting off an old project of mine which calculates a number of simple metrics about large software projects. One of the metrics is the length of files/classes/methods. Currently my code "guesses" where class/method boundaries are based on a very crude algorithm (traverse the file, maintaining a "current depth" and adjusting it whenever you encounter unquoted brackets; when you return to the level a class or method began on, consider it exited). However, there are many problems with this procedure, and a "simple" way of detecting when your depth has changed is not always effective. To make

What is Abstractness vs. Instability Graph?

£可爱£侵袭症+ 提交于 2019-12-03 23:53:18
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 addition to this I need is 'how do I control this ? [controlling abstractness with stability]' Abstractness

Python: code statistics

雨燕双飞 提交于 2019-12-03 05:59:30
Do you know if there's a Python library that generates statistics about code? I'm thinking about pointing to a package and getting number of classes, functions, methods, docblock lines etc. It could eventually include useless stuff like number of lambdas or other crazy statistics, just for fun. Cédric Julien you can have a look at Pymetrics , or check other tools enumerated there Devin Jeanpierre People don't generally make packages out of things that can be done in a dozen or two lines of code. The following analyzes usage of all python syntax and returns a dictionary mapping ast nodes to how

Eclipse metrics plugin suggestion [closed]

南楼画角 提交于 2019-12-03 05:30:38
问题 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 2 years ago . I'm looking for a tool to give me some code metrics (total LOCs, LOC/Class, # of external references/class, etc...). Does anyone know a good eclipse plugin that could provide me some some code metrics? 回答1: here is one called Metrics. edit: i put together a short program for this screenshot in eclipse 3.3.1.1:

How to automate Visual Studio's Code Metrics feature

白昼怎懂夜的黑 提交于 2019-12-03 03:27:17
I want to automate the process of gathering code metrics on a .NET solution. Is there any way of getting msbuild to run the Code Metrics feature included in VS2008 Development Edition? I may end up using SourceMonitor , but I would like to know if there is a way to use the VS code metrics engine from the command line. Finally, Microsoft have provided us with a way to automate the Visual Studio code metrics feature using a new " power tool ". shackett This is how my company has automated FxCop using MSBuild: <!-- The directory where FxCop is installed. --> <FxCopDirectory>C:\Program Files

What can be alternative metrics to code coverage?

怎甘沉沦 提交于 2019-12-03 01:45:19
问题 Code coverage is propably the most controversial code metric. Some say, you have to reach 80% code coverage, other say, it's superficial and does not say anything about your testing quality. (See Jon Limjap's good answer on "What is a reasonable code coverage % for unit tests (and why)?".) People tend to measure everything. They need comparisons, benchmarks etc. Project teams need a pointer, how good their testing is. So what are alternatives to code coverage? What would be a good metric that

Eclipse metrics plugin suggestion [closed]

断了今生、忘了曾经 提交于 2019-12-02 19:57:19
I'm looking for a tool to give me some code metrics (total LOCs, LOC/Class, # of external references/class, etc...). Does anyone know a good eclipse plugin that could provide me some some code metrics? akf here is one called Metrics. edit: i put together a short program for this screenshot in eclipse 3.3.1.1: Edit 2 Metrics New version Thanks @mpartel for the link CodePro AnalytiX originally form Instantiations is now free at Google: http://code.google.com/javadevtools/download-codepro.html Sorry for the necropost but it seems like the right thing to do since this was my starting point. Try

How bad is SLOC (source lines of code) as a metric? [closed]

我的未来我决定 提交于 2019-12-02 19:05:31
We are documenting our software development process. For technical people, this is pretty easy: iterative development with internal milestones every four weeks, external every 3 months. However, the purpose of this exercise is to expose things for our project management in terms that they can understand. Specifically, these non-technical managers need metrics that they can understand. I understand our options for metrics well and have proposed a whole set (requirements met and actual costs vs. budgeted costs are two of my favorites). However, we do have some old hands involved and they tend to