WarningsNG Exporter

Convert and export diagnostic data into WarningsNG native XML format.
14 Downloads
Updated 27 Sep 2022

WarningsNG Exporter for MATLAB

View WarningsNG Exporter on File Exchange Run toolbox demo in MATLAB

The Jenkins Warnings Next Generation Plugin collects compiler warnings or issues of static analysis tools and visualizes the results.

The WarningsNG Exporter for MATLAB is a MATLAB® toolbox and provides a converter for diagnostic messages into the native WarningsNG XML format that can be read by the Jenkins WarningsNG plugin. The converter is intended to be used from within MATLAB scripts that are called as part of a Jenkins CI jobs, e.g. with the help of the Jenkins MATLAB Plugin.

MATLAB and Simulink® provide own methods to display and manage warnings, errors and other diagnostic messages. Currently, the exporter supports the conversion of the following data:

  • Thrown exceptions from MATLAB code (MException and MSLException objects)
  • Output of Simulink simulation runs (Simulink.SimulationOutput and Simulink.SimulationMetadata objects)
  • dSPACE TargetLink® code generator diagnostics message structures
  • checkcode linter messages

In addition, generic warning issues can be created by setting individual issue properties directly.

Requirements

The exporter works with MATLAB R2018b and later. The support for dSPACE TargetLink is optional.

See the Jenkins Warnings Next Generation Plugin for the requirements of the plugin.

Installation

To install a package after download, open MATLAB, navigate to the mltbx file and double-click on it. The toolbox is installed and shows up in MATLAB's Add-On Manager.

Structure

The exporter defines two classes, Report and Issue, within the namespace WarningsNG. The WarningsNG.Issue class represents individual issues in the WarningNG issue data model. The WarningsNG.Report class collects of WarningsNG issues and provides the translation of the issues into the native WarningsNG XML file.

Examples

The following MATLAB code snippets illustrate the use of the exporter.

Creating an generic issue object:

issue = WarningsNG.Issue(...
    'Category', 'Style', ...
    'Type',     'W123', ...
    'Severity', 'LOW', ...
    'Message',  'My own warning');

Adding issues to reports and writing to XML file:

report = WarningsNG.Report();
report.append(issue);
report.xmlwrite();

Exporting Simulink warnings from Simulink runs:

simout = sim('MySim', 'CaptureErrors', 'on');
report = WarningsNG.Report(WarningsNG.Issue(simout), "Simulink_Warnings.xml");
report.xmlwrite();

Exporting dSPACE TargetLink messages:

report = WarningsNG.Report();
msg_count = ds_error_check('warning');
if msg_count > 0
   report.append( WarningsNG.Issue(ds_error_get('Message', 1:msg_count)) );
end
report.xmlwrite();

See the MATLAB demo live script and the Jenkinsfile for further application examples.

Further Documentation

Display the class documentation in MATLAB with

doc WarningsNG.Issue
doc WarningsNG.Report

Cite As

Georg Drenkhahn (2024). WarningsNG Exporter (https://github.com/gedre/warningsng-exporter-for-matlab/releases/tag/v1.2), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with R2018b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

+WarningsNG/@Issue

+WarningsNG/@Report

doc/demo

doc/demo/m

Version Published Release Notes
1.2

See release notes for this release on GitHub: https://github.com/gedre/warningsng-exporter-for-matlab/releases/tag/v1.2

1.1

See release notes for this release on GitHub: https://github.com/gedre/warningsng-exporter-for-matlab/releases/tag/v1.1

1.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.