Sonargraph presents the possibility to write Groovy scripts that will be run over the current software system in order to get specific results.
Scripts support the following use cases (among others): Create and calculate custom metrics, identify specific elements, list dependencies to methods, create issues for detected anti-patterns.
To get an idea of the Script API's power, it is recommended to examine the existing scripts contained in the provided quality models. For the core and each of the supported languages (Java, C#, C++) a script named VisitorExample.scr exists that illustrates the available Script API.
The Script view has two main sections:
-
Script editing area: In this area you can write Groovy based scripts to retrieve information of your system in ways that would not be possible otherwise.
-
Results area: Shows the results from the executed script which can be software system elements, dependencies between the different components of the system, a tree structure of elements, a list of issues, or metrics created by the script.
The execution of the current script can be triggered by clicking the button "Run" below the text edit area.