Mercurial > repos > public > sbplib
changeset 455:cd571e8ec1fd
Add function to run checkcode on all matlab files
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 12 May 2017 16:19:34 +0200 |
parents | 236744dda401 |
children | cf313abea04b 283bdea202d2 |
files | checkAllCode.m findMfiles.m runtestsAll.m |
diffstat | 3 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 236744dda401 -r cd571e8ec1fd checkAllCode.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/checkAllCode.m Fri May 12 16:19:34 2017 +0200 @@ -0,0 +1,6 @@ +% Run matlabs checkcode on all files in current folder including subfolders +function checkAllCode(d) + default_arg('d','') + files = findMfiles(d); + checkcode(files) +end
diff -r 236744dda401 -r cd571e8ec1fd findMfiles.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findMfiles.m Fri May 12 16:19:34 2017 +0200 @@ -0,0 +1,14 @@ +% Find all m files reachable from folder d +function files = findMfiles(d) + contents = what(d); + + files = {}; + for i = 1:length(contents.m) + files{end+1} = fullfile(d, contents.m{i}); + end + + for i = 1:length(contents.packages) + packagePath = fullfile(d,['+' contents.packages{i}]); + files = [files, findMfiles(packagePath)]; + end +end \ No newline at end of file
diff -r 236744dda401 -r cd571e8ec1fd runtestsAll.m --- a/runtestsAll.m Wed Apr 12 13:01:20 2017 +0200 +++ b/runtestsAll.m Fri May 12 16:19:34 2017 +0200 @@ -1,6 +1,8 @@ function res = runtestsAll() l = dir(); + warning('Simplify using the ''what'' command') + dirNames = {l([l.isdir]).name}; packages = {};