drtools-metric

If I download a GitHub project, where are the biggest problems? Where do I start the investigation?

Description

The drtools-metric was born from the need to be a simple tool that could help the developer with his daily work.

The vast majority of metric tools are server-side, requiring multiple configurations and environments to use. The drtools-metric came up with this approach as a premise: simplicity. For this reason, it is a CLI (command-line interface) tool. We believe the command line has great power and flexibility.

We have studied and selected some metrics that, combined, can give developers many insights before looking at the code. We also seek to bring a presentation that would make it easier for developers to analyze. We defined a set of analysis heuristics based on these metrics to facilitate and educate the developer in these investigations.

drtools-metric in action

Requirements and Install Instruction

  • Unique requirement: JRE version 8
  • Download the tool version and unzip it to a directory
  • We suggest placing the directory reference in the system PATH, and Done!

Main Features

  • Command-line (CLI) usage
  • Flexibility
  • Download and run!
  • Context-selected and sorted metrics
  • Supported languages: Java (for now)
  • Outputs in different formats: console, CSV, and JSON
  • ease of filtering results (using the '--top X' option)
  • Contextualized results, to facilitate the analysis and investigation (metric thresholds are available here)
  • To visualize graphs of project data, simply use drtools-metric visualization. To do so, you can generate the data using the -mv option and --save output format.

Context and Metrics

The drtools-metric presents the 33 metrics contextualized by summary, namespaces, types, methods, dependencies, and coupling. The following is the list of metrics by context:

  • Summary (9): Total of namespaces, total of types, mean number of types/namespaces, total of lines of code (SLOC), mean number of SLOC/types, total of methods, mean number of methods/types, total of complexity (CYCLO), and mean number of complexity/types
  • Namespaces (2): Number of classes/types (NOC) and number of abstract classes (NAC)
  • Types (9): Lines of code (SLOC), number of methods (NOM), number of public methods (NPM), class complexity (WMC), number of dependencies (DEP), number of internal dependencies (I-DEP), Number of other types that depend on a given type (FAN-IN), number of other types referenced by a type (FAN-OUT), and number of fields/attributes (NOA)
  • Methods (5): Lines of code (MLOC), cyclomatic complexity (CYCLO), number of invocations (CALLS), nested block depth (NBD), and number of parameters (PARAM)
  • Namespace Coupling (5): Afferent coupling (CA), efferent coupling (CE), instability (I), abstractness degree (A), and normalized distance (D)
  • Type Coupling (4): number of dependencies (DEP), number of internal dependencies (I-DEP), Number of other types that depend on a given type (FAN-IN), and number of other types referenced by a type (FAN-OUT)
  • Dependencies (3): General dependencies (DEP), internal dependencies (I-DEP), and cyclic dependencies

Video Demonstration

Usage examples

Below we list many examples of using drtools-metric features.

  • Viewing tool usage options
  • prompt> drtools-metric

  • Viewing metric thresholds (console), using the option -mt
  • prompt> drtools-metric \repo\DrToolsMetric\src -mt --console

  • Viewing project summary information (console), using the option -s
  • prompt> drtools-metric \repo\DrToolsMetric\src -s --console

  • Viewing information about namespaces (console), using the option -n
  • prompt> drtools-metric \repo\DrToolsMetric\src -n --console

  • Viewing information about types (console), using the option -t
  • prompt> drtools-metric \repo\DrToolsMetric\src -t --console

  • Viewing information about the top 10 complex types (console), using the option --top
  • prompt> drtools-metric \repo\DrToolsMetric\src -t --console --top 10

  • Viewing information about types (CSV), using the option --csv
  • prompt> drtools-metric \repo\DrToolsMetric\src -t --csv > drtools-metric-types.csv

  • Viewing information about types (JSON), using the option --json
  • prompt> drtools-metric \repo\DrToolsMetric\src -t --json > drtools-metric-types.json

  • Generating all files needed for viewing with drtools-metric-visualization, using the -mv option and --save output
  • prompt> drtools-metric \repo\DrToolsMetric\src -mv --save

  • Viewing information about methods (console), using the option -m
  • prompt> drtools-metric \repo\DrToolsMetric\src -m --console

  • Verifying if the project has cyclic dependencies, using the option -cd
  • prompt> drtools-metric \repo\DrToolsMetric\src -cd --console

  • Viewing information about all dependencies (console), using the option -d
  • prompt> drtools-metric \repo\DrToolsMetric\src -d --console

  • Viewing information about internal dependencies (console), using the option -id
  • prompt> drtools-metric \repo\DrToolsMetric\src -id --console

  • Viewing information about namespace coupling (console), using the option -nc
  • prompt> drtools-metric \repo\DrToolsMetric\src -nc --console

  • Viewing information about type coupling (console), using the option -tc
  • prompt> drtools-metric \repo\DrToolsMetric\src -tc --console