how to automatically identify errors in the output of checkcode

1 回表示 (過去 30 日間)
Arabarra
Arabarra 2019 年 10 月 1 日
コメント済み: Arabarra 2021 年 3 月 18 日
Hi,
my project comprises thousands of matlab functions, some of them created automatically... I need a way to check that there is no error in any of them... obviosuly without having to open them one by one!
Unfortunately, the structure created by mlint (now checkcode) does not output explicitely which entries represent errors and which warnings.
The only apparent way to achieve what I want is with the .id field that details the code of each of the entry of the structure, but I do not know where they have been defined... is there any documentation of that?
  1 件のコメント
Florian Osterloh
Florian Osterloh 2020 年 8 月 13 日
Did you find any soloution I need this as well ?

サインインしてコメントする。

回答 (2 件)

Tejaswini Veduruvada
Tejaswini Veduruvada 2020 年 3 月 23 日
You can refer to the below documentation link on how to use “checkcode” function to find possible errors :
  1 件のコメント
Arabarra
Arabarra 2020 年 6 月 15 日
I checked, and I am still not able to find an answer to my question. The function "checkcode" outputs a wide report, without distinguishing between suggestions, warnings and downright errors... or did I skip something?

サインインしてコメントする。


Steven Lord
Steven Lord 2020 年 8 月 13 日
Generally speaking, a Code Analyzer red message (error) will prevent the code from executing.
So if you have tests for the large number of functions that make up your project, running those tests should detect Code Analyzer red messages.
  5 件のコメント
Matt Butts
Matt Butts 2021 年 3 月 12 日
I was looking for this same thing, and while I agree that writing tests will capture this as well, I have some functions that use GUI elements and just don't run nicely in my CI system. For those, I would like to check this using checkcode.
Here is what I did though:
  1. Create a code analyzer settings file using the menu under Preferences -> Code Analyzer
  2. I used the filters to turn everything off (disable)
  3. I then filtered to just errors and set them to on (enable)
  4. I saved that as a settings file
  5. Call checkcode using the -config option: checkcode('myfunc','-config=onlyErrors.txt')
Arabarra
Arabarra 2021 年 3 月 18 日
thanks Matt! Good idea, I'll try this.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by