how to automatically identify errors in the output of checkcode
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Tejaswini Veduruvada
2020년 3월 23일
You can refer to the below documentation link on how to use “checkcode” function to find possible errors :
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
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:
- Create a code analyzer settings file using the menu under Preferences -> Code Analyzer
- I used the filters to turn everything off (disable)
- I then filtered to just errors and set them to on (enable)
- I saved that as a settings file
- Call checkcode using the -config option: checkcode('myfunc','-config=onlyErrors.txt')
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!