Dart software metrics

153 views
Skip to first unread message

Mukhammadjon Jalolov

unread,
Apr 27, 2018, 5:26:01 PM4/27/18
to Dart Analyzer Discussion
Hello everyone! Is there any tools for Dart language to extract software metrics e.g. Mainainability Index, Cyclomatic Complexity, Halstead metrics etc.? From a Dart source code? Thanks much!

Brian Wilkerson

unread,
Apr 27, 2018, 5:30:34 PM4/27/18
to analyzer...@dartlang.org
The analyzer doesn't have any direct support for metrics, though metrics could certainly be computed based on the results of analysis.

That said, this is a fairly specialized list focused on the analyzer and analysis server. You might want to re-post this to a larger group, such as `mi...@dartlang.org`, to see whether someone in the larger Dart community has done anything along those lines.

On Fri, Apr 27, 2018 at 1:52 PM, Mukhammadjon Jalolov <mjalol...@gmail.com> wrote:
Hello everyone! Is there any tools for Dart language to extract software metrics e.g. Mainainability Index, Cyclomatic Complexity, Halstead metrics etc.? From a Dart source code? Thanks much!

--
You received this message because you are subscribed to the Google Groups "Dart Analyzer Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzer-discuss+unsubscribe@dartlang.org.
Visit this group at https://groups.google.com/a/dartlang.org/group/analyzer-discuss/.

Alexei Diaz

unread,
Apr 30, 2018, 11:34:40 PM4/30/18
to Dart Analyzer Discussion
Hi all,

I started a prototype last year, it has a few method and class metrics https://github.com/alexeieleusis/dart-lang_linter/commits/elastograph, heavily inspired by NDepend, it is in very early stages and I haven't worked on it for at least 5 months. Still I think the metrics it computes are already useful, I started it with the linter code base for convenience but its use case is so different that I will fork it or start a new project from scratch. If you are really interested in trying it, we can start a conversation offline so I can explain to you how to use it, I need to push code from my working copy.

The following metrics are implemented:
  • Class level:
    • Depth of inheritance tree.
    • Field count.
    • Implemented interfaces count.
    • Lack of cohesion methods.
    • LCOM HS.
    • Method count.
  • Method level:
    • Assignment count.
    • Free variables mutation count.
    • Mutable variables count.
    • Nesting depth.
    • Optional parameters count.
    • Parameters count.
    • Variables count.
  • Both levels:
    • Afferent coupling.
    • Cyclomatic complexity.
    • Efferent coupling.
    • Statement count.
If you look at the code you will notice that only the method level metrics are on github, this is because I mixed the code with a statistical analysis (on the static analysis report) for a big codebase trying to understand which metrics shed more light on possible bugs. Also there is a bug in the underlying infrastructure (linter or analyzer I don't remember) that prevents some of the metrics from being computed. But as I said above, if you are interested in using it, I can clean it up and push the code to github, I must warn that reading the report is an effort by itself, but there are plans to improve it.

Best
Alexei


On Friday, April 27, 2018 at 2:30:34 PM UTC-7, brianwilkerson wrote:
The analyzer doesn't have any direct support for metrics, though metrics could certainly be computed based on the results of analysis.

That said, this is a fairly specialized list focused on the analyzer and analysis server. You might want to re-post this to a larger group, such as `mi...@dartlang.org`, to see whether someone in the larger Dart community has done anything along those lines.
On Fri, Apr 27, 2018 at 1:52 PM, Mukhammadjon Jalolov <mjalol...@gmail.com> wrote:
Hello everyone! Is there any tools for Dart language to extract software metrics e.g. Mainainability Index, Cyclomatic Complexity, Halstead metrics etc.? From a Dart source code? Thanks much!

--
You received this message because you are subscribed to the Google Groups "Dart Analyzer Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to analyzer-discu...@dartlang.org.

Mukhammadjon Jalolov

unread,
May 11, 2018, 7:05:29 PM5/11/18
to Dart Analyzer Discussion
Yes that would be great! I very need to compute metrics for my Diploma Project. How Can we contact offline? I just need to get metric results from my Dart Code. Even though with not perfect results.
Thanks!

Shan Khinda

unread,
May 12, 2019, 5:36:46 PM5/12/19
to Dart Analyzer Discussion
Hey is there any way you would be able to help me out on this? I needed to compute the LCOM for my files.
Reply all
Reply to author
Forward
0 new messages