matlab.codeanalysis.validateConfiguration - Validate Code Analyzer configuration file - MATLAB (original) (raw)

Main Content

Validate Code Analyzer configuration file

Since R2023a

Syntax

Description

[issuesTable](#mw%5F7a565627-05e6-4a40-98b6-fe5d296df878) = matlab.codeanalysis.validateConfiguration validates the Code Analyzer configuration file,codeAnalyzerConfiguration.json, in the current folder and returns a table containing any identified issues.

For more information about Code Analyzer configuration, see Configure Code Analyzer.

[issuesTable](#mw%5F7a565627-05e6-4a40-98b6-fe5d296df878) = matlab.codeanalysis.validateConfiguration([pathname](#mw%5F3ca535db-93c5-42fc-8777-3ae6f3588e22)) validates the Code Analyzer configuration file in the folder or thecodeAnalyzerConfiguration.json file specified bypathname.

example

Examples

collapse all

Validate the Code Analyzer configuration file in theresources folder of C:\MyCode.

issuesTable = matlab.codeanalysis.validateConfiguration("C:\MyCode")

issuesTable =

1×9 table

            Location                Severity                                             Message                                               MessageID       LineStart    LineEnd    ColumnStart    ColumnEnd                        FullFilename                    
________________________________    ________    _________________________________________________________________________________________    ______________    _________    _______    ___________    _________    ____________________________________________________

"codeAnalyzerConfiguration.json"    warning     "Check name "MyOwnCheck" not found, or "rule" field is missing to create a custom check."    UnknownCheckId       20          20            9            20        "C:\MyCode\resources\codeAnalyzerConfiguration.json"

Input Arguments

collapse all

Configuration file location, specified as a string scalar or character vector. The location can contain a partial or full path to a configuration file or folder containing a configuration file.

Example: "C:\MyCode\resources"

Example: "../codeAnalyzerConfiguration.json"

Output Arguments

collapse all

Identified issues, returned as a table with these columns:

Column Name Column Purpose
Location Name of analyzed configuration file, which also functions as a hyperlink to the location of the issue in the configuration file.
Severity Severity of the message, specified as error,warning, or info.
Message Description of the issue
MessageID Check identifier of issue
LineStart Line number in the configuration file where issue begins
LineEnd Line number in the configuration file where issue ends
ColumnStart Column number in the configuration file where issue begins
ColumnEnd Column number in the configuration file where issue ends
FullFilename Full path to configuration file

Version History

Introduced in R2023a

expand all

The output table includes a column called Severity to show the severity of an issue, specified as error, warning, orinfo.

The ErrorMessage and ErrorID columns have been renamed to Message and MessageID respectively.