Updated 27 Sep 2022
WarningsNG Exporter for 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 (
- Output of Simulink simulation runs (
- dSPACE TargetLink® code generator diagnostics message structures
In addition, generic warning issues can be created by setting individual issue properties directly.
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.
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.
The exporter defines two classes,
Issue, within the namespace
WarningsNG.Issue class represents individual issues in the WarningNG issue data model.
WarningsNG.Report class collects of WarningsNG issues and provides the translation of the issues into the native WarningsNG XML file.
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();
Display the class documentation in MATLAB with
doc WarningsNG.Issue doc WarningsNG.Report
Georg Drenkhahn (2023). WarningsNG Exporter (https://github.com/gedre/warningsng-exporter-for-matlab/releases/tag/v1.2), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
See release notes for this release on GitHub: https://github.com/gedre/warningsng-exporter-for-matlab/releases/tag/v1.2
See release notes for this release on GitHub: https://github.com/gedre/warningsng-exporter-for-matlab/releases/tag/v1.1