Method Toxicity Metrics

From RAD Studio
Jump to: navigation, search

Go Up to Project Menu

CodeAnalysis.png

Project > Method Toxicity Metrics

The Method Toxicity Metrics page shows a list of all the methods in the active project, along with key metrics about each method:

  • Length: The number of lines in the method, or more accurately, the number of code statements in the method.
  • Parameters: The number of parameters in the method declaration.
  • If Depth: The maximum depth of nested if statements present in the method.
  • Cyclomatic Complexity: The minimum number of independent code paths through the method. This is the minimum number of tests that would have to be executed in order to ensure that every line of code in the method is tested. Note that cyclomatic complexity is not the total number of independent code paths, but the minimal number of independent paths.
  • Toxicity: Toxicity combines all the above metrics to create a single value for how toxic a method is.

The Method Toxicity Metrics page uses a red background for values that are higher than the defined threshold. You can customize the threshold for each metric in the Toxicity Metrics options page. The threshold of the Toxicity value is always 1, you cannot change it.

You can double-click any method in the list to open its implementation.

At the bottom of the Method Toxicity Metrics page you have:

  • A Save button that you can use to export your metrics in CSV format.
  • A Refresh button that you can use to update the metrics shown on the page after changes to the code base.