drtools-code health

If I download a GitHub project, where are the biggest problems?

Where do I start the investigation?

Description

The DR-Tools Code Health was born from the need to be a simple tool that could help the developer with his daily work.

DR-Tools Code Health is a tool that allows for a deeper investigation regarding metrics/statistics, design issues (smells), smell co-occurrences, and code elements ranking/prioritization, identifying the most problematic parts at different levels of granularity.

drtools-code health in action

Requirements and Install Instruction

  • Unique requirement: JRE version 11
  • Download the tool version and unzip it to a directory
  • We suggest placing the directory reference in the system PATH, and Done!
  • More detailed information can be accessed here

Main Features

  • Modes: Command-line (CLI, using --init and --analyze options) and Interactive usage (command prompt)
  • 48 metrics contextualized by summary, namespaces, types, methods, dependencies, and coupling
  • Detects 15 smells at the granularities of namespace, type, and method
  • Detects 20 smell co-occurrences categorized by type, method, and inter-components
  • Context-selected and sorted metrics
  • Customization using programming (fluent API) and config file
  • Statistic analysis of code
  • Supported languages: Java (for now)
  • Outputs in different formats: console, CSV, and JSON
  • ease of filtering results (using the --top option)
  • Implements a prioritization model adopting criteria such as severity, representativity, impact on quality, and degree of intervention. It is also possible to aggregate the criteria into an global indicator that presents the most problematic code elements at a given granularity, called the Code Disease Indicator (CDI).
  • Download and run!
  • More information here!

Usage Modes

DR-Tools Code Health Execution Modes: As input, the project's source code and a project configuration file (optional) are used.

This configuration file contains information customized by developers to adapt the project's analyses. DR-Tools Code Health offers two usage modes: CLI, through the options --init and --analyze, creating directories, configuration files, and analysis results in CSV and JSON formats; Interactive mode allows developers to analyze the project, observe metrics, statistics, smells, and prioritization via a command prompt.

More detailed information about usage modes can be found here.

Internal Process

How does DR-Tools Code Health work internally?

Starting from the project's source code input and the configuration file (optional), a series of actions are performed - (1) loading the project's general information; (2) analyzing the code elements and their respective (3) calculation of metrics and statistics considering the current state; (4) loading the detection heuristics for smells and co-occurrences based on the previous information; (5) detecting smells and co-occurrences based on the heuristics; (6) computing the ranking based on criteria (e.g., severity, impact on quality); (7) prioritizing code elements using individual criteria and the aggregated CDI (Code Disease Indicator); and finally, (8) project data ready to be generated in file format (CLI mode) or manipulated and queried via the prompt (interactive mode).

More detailed information about modules can be found here.

How can I analyze source code with DR-Tools Code Health?

To demonstrate how DR-Tools Code Health can assist developers, we present a practical case using FindBugs. We evolve step by step, defining each objective and evaluating the results presented by the tool.

All the details can be found here.