Skip to content

Commit 573712e

Browse files
authored
Merge pull request #154 from ImperialCollegeLondon/dev/small-improvements
dev: Small improvements
2 parents 75e7192 + 9a62156 commit 573712e

File tree

611 files changed

+1231
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

611 files changed

+1231
-350
lines changed

.github/workflows/package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up MATLAB
1717
uses: matlab-actions/[email protected]
1818
with:
19-
release: R2024b
19+
release: R2025a
2020
- name: Load Environment Variables
2121
uses: aarcangeli/[email protected]
2222
- name: Validate version with tag

.github/workflows/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Run MATLAB Tests
1616
strategy:
1717
matrix:
18-
release: ["R2024a", "R2024b"]
18+
release: ["R2024a", "R2024b", "R2025a"]
1919
runs-on: windows-latest
2020
steps:
2121
- name: Check out repository
@@ -63,9 +63,14 @@ jobs:
6363
use-actions-summary: 'false'
6464
- name: Report coverage
6565
uses: 5monkeys/cobertura-action@master
66-
if: matrix.release == 'R2024b'
66+
if: matrix.release == 'R2025a'
6767
with:
6868
path: 'artifacts/coverage.xml'
6969
minimum_coverage: 80
7070
skip_covered: true
7171
report_name: Coverage Report (${{ matrix.release }})
72+
- name: Upload SARIF file
73+
uses: github/codeql-action/upload-sarif@v3
74+
if: matrix.release == 'R2025a'
75+
with:
76+
sarif_file: artifacts/issues.sarif

app/DataVisualization.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function exportButtonPushed(app)
242242

243243
variableName = app.createMissionSpecificVariable();
244244

245-
if evalin("base", compose("exist(""%s"", ""var"")", variableName))
245+
if evalin("base", compose("exist(""%s"", ""var"")", variableName)) %#ok<EVALIN>
246246

247247
selectedOption = uiconfirm(app.UIFigure, compose("Variable <code>%s</code> already exists in the MATLAB Workspace.", variableName) + ...
248248
" Would you like to overwrite it?", "Variable Already Exists", Interpreter = "html");

buildfile.m

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
function plan = buildfile()
22
% BUILDFILE File invoked by automated build.
33

4-
project = matlab.project.currentProject();
4+
% Create a plan from task functions.
5+
plan = buildplan();
56

6-
if isempty(project) || ~isequal(project.Name, "MAG Data Visualization")
7+
% Get current project.
8+
if isMATLABReleaseOlderThan("R2025a")
79

8-
project = matlab.project.loadProject("MAGDataVisualization.prj");
9-
restore = onCleanup(@() project.close());
10-
end
10+
project = matlab.project.currentProject();
1111

12-
% Create a plan from task functions.
13-
plan = buildplan();
12+
if isempty(project) || ~isequal(project.Name, "MAG Data Visualization")
13+
14+
project = matlab.project.loadProject("MAGDataVisualization.prj");
15+
restoreProject = onCleanup(@() project.close());
16+
end
17+
else
18+
project = plan.Project;
19+
end
1420

1521
% Add the "check" task to identify code issues.
1622
sourceFolders = ["app", "src"];
1723

1824
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(sourceFolders, ...
19-
IncludeSubfolders = true);
25+
IncludeSubfolders = true, ...
26+
Results = fullfile("artifacts/issues.sarif"));
2027

2128
% Add the "test" task to run tests.
2229
testFolders = ["tests/system", "tests/unit"];
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
// Configuration File Information
3+
"name": "MAG Lab Guidelines",
4+
"description": "MAG Lab MATLAB style guidelines",
5+
"author": "Michele Facchinelli",
6+
"schemaVersion": "1.1.0",
7+
"guidelineVersion": "1.0.0",
8+
9+
// New and Modified Checks
10+
"checks":
11+
{
12+
// ======================================
13+
// Enable additional Code Analyzer checks
14+
// ======================================
15+
"EVALIN":
16+
{
17+
"rule":
18+
{
19+
"template": "functionCall",
20+
"functionNames": "evalin"
21+
},
22+
"severity": "error",
23+
"messageText": "Do not use evalin.",
24+
"enabled": true
25+
},
26+
"VARNAME":
27+
{
28+
"rule":
29+
{
30+
"template": "variableName",
31+
"variableNames": ["size", "error", "length", "max", "isa", "nargin" , "numel" , "nargout" ,"isequal" , "zeros" , "true" ,"false" ,"fullfile" ,"find", "get"]
32+
},
33+
"severity": "warning",
34+
"messageText": "Avoid using function names for variables.",
35+
"enabled": true
36+
},
37+
"LLMNC":
38+
{
39+
// Disallow very long lines (too many characters)
40+
"severity": "error",
41+
"limit": 1000,
42+
"enabled": true
43+
},
44+
"FCNOL":
45+
{
46+
// Disallow too many outputs
47+
"severity": "error",
48+
"messageText": "Too many outputs.",
49+
"limit": 15,
50+
"enabled": true
51+
},
52+
// =================================================
53+
// Increase severity of default Code Analyzer checks
54+
// =================================================
55+
"GVMIS":
56+
{
57+
// Do not use global variables
58+
"severity": "error"
59+
},
60+
"EVLCS":
61+
{
62+
// "eval" family of functions is slow and unclear
63+
"severity": "error"
64+
},
65+
"NOANS":
66+
{
67+
// Do not use "ans" as a variable
68+
"severity": "error"
69+
},
70+
"CHAIN":
71+
{
72+
// Chained logical operations like "a > b > c" are usually a bug
73+
// For scalars, it should be: "(a > b) && (b > c)"
74+
// For arrays, it should be: "(a > b) & (b > c)"
75+
"severity": "error"
76+
}
77+
},
78+
79+
// Naming Conventions
80+
"naming":
81+
{
82+
// ============================================================
83+
// Enable naming conventions for different types of identifiers
84+
// ============================================================
85+
"property": {
86+
"casing": "UpperCamelCase"
87+
},
88+
"function": {
89+
"casing": "lowerCamelCase"
90+
},
91+
"class": {
92+
"casing": "UpperCamelCase"
93+
},
94+
"method": {
95+
"casing": ["lowercase", "lowerCamelCase"],
96+
"regularExpression": "^([a-z]+|[a-z]+([A-Z][a-z0-9]*)*)$"
97+
},
98+
"localFunction": {
99+
"casing": "lowerCamelCase"
100+
},
101+
"nestedFunction": {
102+
"casing": "lowerCamelCase"
103+
},
104+
"event": {
105+
"casing": "UpperCamelCase"
106+
},
107+
"enumeration": {
108+
"casing": "UpperCamelCase",
109+
"regularExpression": "^([A-Z][a-z0-9]+)$"
110+
},
111+
"variable": {
112+
"casing": ["lowercase", "lowerCamelCase"]
113+
}
114+
}
115+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Info location="+validator" type="File"/>

resources/project/-h2L0hF035doqVvcUhcvKfD_LcU/tJoJUUQFqIf2Zhu0rDTqRSIMq50p.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Info location="Type.m" type="File"/>
2+
<Info location="psd.m" type="File"/>

0 commit comments

Comments
 (0)