-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuildfile.m
31 lines (23 loc) · 881 Bytes
/
buildfile.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function plan = buildfile()
plan = buildplan(localfunctions);
plan.DefaultTasks = ["check","test"];
warning_threshold = 0;
if isMATLABReleaseOlderThan("R2023b")
plan("test") = matlab.buildtool.Task( ...
Description="Run tests", ...
Actions=@(~) assert(runtests().Failed == 0));
plan("check") = matlab.buildtool.Task(...
Description="Identify code issues", ...
Actions=@(~) assert(code_issues(warning_threshold)));
return;
end
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(WarningThreshold=warning_threshold);
plan("test") = matlab.buildtool.tasks.TestTask;
end
function flag = code_issues(warning_threshold)
issues = codeIssues().Issues;
disp(issues);
errors = find(issues.Severity == 'error');
warnings = find(issues.Severity == 'warning');
flag = (numel(errors) == 0) && (numel(warnings) <= warning_threshold);
end