Where do I find the list of possible messages and IDs returned by checkcode?
4 views (last 30 days)
Show older comments
For my company's software quality process, I need to determine and report the number of 'blocking' and 'critical' quality violations in my MATLAB code.
The standard tool we use for this (Sonar Qube) doesn't support MATLAB and there doesn't seem to be a built-in way of doing it in the MATLAB IDE, so I've written a short script that runs checkcode on each .m file in the project folder structure and compiles the output into a report. The struct output from checkcode includes a short text ID for each message, for example AGROW is The variable (name) appears to change size on every loop iteration. Consider preallocating for speed.
I want to categorise each message as blocking, critical or non-critical according to a coding standard that we will set, so that I can count up how many messages fell into each category. Can I get a complete list of the possible messages and their IDs, for any given version of MATLAB? There's nothing in the checkcode help, and the settings file saved from the Code Analyzer preferences doesn't seem to contain this information.
0 Comments
Answers (1)
Santtu Söderholm
on 14 May 2023
Edited: Santtu Söderholm
on 14 May 2023
Since all linter tools provided by Matlab, such as mlint, checkcode and since R2023A codeIssues, ultimately fall back onto the Code Analyzer, the documentation related to linting messages can be found on the index page for Code Analyzer checks (link).
2 Comments
Santtu Söderholm
on 22 May 2023
@Tom Hawkins I ended up writing a little web scraper (link), that fetches all of the messages and their severities from the MathWorks website and prints them to standard output, from which they can be redirected to a CSV file:
python3 -m pip install -r requirements.txt
python3 run.py > matlab-linter-messages.csv
The column separator is the (unadjustable) ASCII unit separator character ␟, which is a bit unstandard, but I wanted to avoid clashes with commas and other typical CSV delimiters.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!