Using the command
checkcode('function.m')
you can run the code analyzer on an m-file and output the report in the command window. Is there any way to do this for TODO/FIXME reports? (without having to cd to the folder that contains the function and manually run it on the whole directory)
Bonus: If so, is it also possible to create custom tags? In eclipse, you can create custom TODO tags like "MTODO" and "JTODO" for different purposes/different people and have them displayed separately. Is this possible in Matlab? Thanks in advance for any help! I will be continuing my google searches and will post the results if I find something.
You can use the internal function dofixrpt
. This returns the HTML displayed in the report, rather than displaying the information at the command line, however.
% Run the report and show it
cd('myfolder')
dofixrpt;
% Alternatively, get the HTML of the report directly
html = dofixrpt;
% Write the HTML to a file
filename = tempname;
fid = fopen(filename, 'w');
fprintf(fid, '%s', html);
fclose(fid);
% View the HTML file
web(filename)
Type which dofixrpt
or edit dofixrpt
to see more details about what it does (it's basically a regular expression search for %.*TODO
and %.*FIXME
).
In the HTML report, you can find markers other than TODO and FIXME by specifying a custom marker (the default is NOTE). Unfortunately you can specify only one. If you're up to looking within dofixrpt
and modifying it very slightly though, it would be very easy to make it look for more.
Finally you could also put in an enhancement request with MathWorks to provide a command similar to checkcode
that will just do this for you and return the results at the command line. It seems like that would be very easy for them to do, and I'm surprised they haven't already done it, given that they've done something similar for helprpt
, coveragerpt
, deprpt
etc.
Hope that helps!