Where do I find the list of possible messages and IDs returned by checkcode?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Santtu Söderholm
2023-5-14
编辑:Santtu Söderholm
2023-5-14
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 个评论
Santtu Söderholm
2023-5-22
@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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!