how to automatically identify errors in the output of checkcode
Mostra commenti meno recenti
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 Commento
Florian Osterloh
il 13 Ago 2020
Did you find any soloution I need this as well ?
Risposte (2)
Tejaswini Veduruvada
il 23 Mar 2020
0 voti
You can refer to the below documentation link on how to use “checkcode” function to find possible errors :
1 Commento
Arabarra
il 15 Giu 2020
Steven Lord
il 13 Ago 2020
0 voti
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 Commenti
Arabarra
il 31 Dic 2020
Steven Lord
il 31 Dic 2020
Suppose you had a function:
function y = multiply(a, b)
y = a+b;
end
That's perfectly legal code to write. Code Analyzer will not flag anything about that function. But logically that function is completely wrong. The only automated way to detect that logical error in the code is to run it and check the answers the function returns, and one way to do that (which will also detect red Code Analyzer errors) is to write tests.
Arabarra
il 12 Gen 2021
Matt Butts
il 12 Mar 2021
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')
Arabarra
il 18 Mar 2021
Categorie
Scopri di più su Identify Code Issues in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!