Skip to content

Commit b62cf11

Browse files
authored
Merge pull request #162 from ImperialCollegeLondon/dev/pre-commit
dev: Add pre-commit
2 parents 7af552f + e1350d3 commit b62cf11

File tree

27 files changed

+1227077
-1227021
lines changed

27 files changed

+1227077
-1227021
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ about: Create a report to help us improve
44
title: "[BUG]"
55
labels: bug
66
assignees: mfacchinelli
7-
87
---
8+
## Describe the Bug
99

10-
# Describe the Bug
1110
A clear and concise description of what the bug is.
1211

13-
# To Reproduce
12+
## To Reproduce
13+
1414
Information to reproduce the behavior:
15+
1516
1. Which data set?
1617
2. Which processing settings?
1718
3. Step-by-step description, if applicable.
1819
4. What is the error?
1920

20-
# Additional Information
21+
## Additional Information
2122

2223
* Version: vX.X.X
2324
(Output of `mag.version()`)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pre-Commit Auto-Update
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 1 * *" # midnight every first of the month
6+
7+
jobs:
8+
auto-update:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
- uses: browniebroke/pre-commit-autoupdate-action@main
14+
- uses: peter-evans/create-pull-request@v7
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
branch: update/pre-commit-hooks
18+
base: main
19+
title: "Chore: Update Pre-Commit Hooks"
20+
commit-message: "chore: update pre-commit hooks"
21+
body: Update versions of pre-commit hooks to latest version.

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ concurrency:
1010
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1111

1212
jobs:
13+
qa:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: pre-commit/[email protected]
1318

1419
test:
1520
name: Run MATLAB Tests

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-json
6+
exclude: resources/codeAnalyzerConfiguration.json|tests/unit/data/imap/test_data/invalid.json
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: check-xml
10+
- id: check-merge-conflict
11+
- id: trailing-whitespace
12+
- id: pretty-format-json
13+
args: [--autofix, --indent, "4"]
14+
exclude: resources/codeAnalyzerConfiguration.json|tests/unit/data/imap/test_data/invalid.json
15+
- repo: https://github.com/python-jsonschema/check-jsonschema
16+
rev: "0.33.0"
17+
hooks:
18+
- id: check-github-workflows
19+
- repo: https://github.com/igorshubovych/markdownlint-cli
20+
rev: v0.45.0
21+
hooks:
22+
- id: markdownlint-fix
23+
args: [--ignore, LICENSE.md, --disable, MD013]

.vscode/settings.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
{
2-
"files.exclude": {
3-
"**/._*": true,
4-
"**/*.*~": true,
5-
"**/*.asv": true,
6-
"**/*~": true
7-
},
8-
"search.exclude": {
9-
"**/._*": true,
10-
"**/*.*~": true,
11-
"**/*.asv": true,
12-
"**/*~": true
13-
},
142
"cSpell.words": [
153
"AGROW",
164
"Bartington",
@@ -24,5 +12,17 @@
2412
"SOLARORBITER",
2513
"Stackedplot",
2614
"SUPPORTEDEVENTS"
27-
]
28-
}
15+
],
16+
"files.exclude": {
17+
"**/*.*~": true,
18+
"**/*.asv": true,
19+
"**/*~": true,
20+
"**/._*": true
21+
},
22+
"search.exclude": {
23+
"**/*.*~": true,
24+
"**/*.asv": true,
25+
"**/*~": true,
26+
"**/._*": true
27+
}
28+
}

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ The following MATLAB toolboxes are required to use the toolbox:
1616

1717
The following external MATLAB libraries are required:
1818

19-
* MATLAB SPICE (MICE): https://naif.jpl.nasa.gov/naif/toolkit_MATLAB.html
20-
* MATLAB SPDF CDF: https://cdf.gsfc.nasa.gov/html/sw_and_docs.html
19+
* MATLAB SPICE (MICE): <https://naif.jpl.nasa.gov/naif/toolkit_MATLAB.html>
20+
* MATLAB SPDF CDF: <https://cdf.gsfc.nasa.gov/html/sw_and_docs.html>
2121

2222
## Getting Started
2323

2424
The toolbox adds to the path many functions and classes that can be used for data processing and visualization. These can be found under the `mag` namespace; you can use tab-completion to see what is available:
25+
2526
``` matlab
2627
mag.<TAB>
2728
```
29+
2830
In the sections below you can find more information about some of the functionalities.
2931

3032
## User Manual
@@ -33,7 +35,7 @@ See [internal documentation](https://imperialcollege.atlassian.net/wiki/spaces/P
3335

3436
## Development
3537

36-
When developing new features or fixing issues, create a new branch. After finishing development, make sure to write tests to cover any new changes.
38+
When developing new features or fixing issues, create a new branch. After finishing development, make sure to write tests to cover any new changes.
3739

3840
To change the version of the toolbox, modify the `MAG_DATA_VISUALIZATION_VERSION` variable in `.env`. This will automatically updated the toolbox version and create a new release with the correct tag.
3941
Also, update the contents of the `resources/release-notes.md` file by detailing what has changed in the new version.
@@ -43,4 +45,4 @@ Also, update the contents of the `resources/release-notes.md` file by detailing
4345
MAG Data Visualization Toolbox is released under the [MIT license][license].
4446

4547
[license]: LICENSE.md
46-
[sml]: http://www.imperial.ac.uk/space-and-atmospheric-physics/research/areas/space-magnetometer-laboratory/
48+
[sml]: http://www.imperial.ac.uk/space-and-atmospheric-physics/research/areas/space-magnetometer-laboratory/

app/DataVisualization.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ function resetButtonPushed(app)
224224

225225
for manager = [app.AnalysisManager, app.ResultsManager, app.ExportManager, app.VisualizationManager]
226226
manager.reset();
227-
end
227+
end
228228
end
229229

230230
function exportButtonPushed(app)

resources/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66

77
- (All) Add option to specify PNG resolution when saving figures
88
- (IMAP) Improve estimation of mode change events
9+
10+
## Project
11+
12+
- Add pre-commit configuration

src/analyze/calibration/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ For temperatures, the following scales apply:
88
- Cool Temperature: approx. -10 °C (FM5), 0 °C (FM4)
99
- Cold Temperature: approx. -20 °C (FM5), -30 °C (FM4)
1010

11-
Data was extracted from calibration report by IGEP. The misalignment matrix is represented by the reduced transfermatrix, which combines misalignment and scale factor.
11+
Data was extracted from calibration report by IGEP. The misalignment matrix is represented by the reduced transfermatrix, which combines misalignment and scale factor.

src/analyze/resources/alias.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"OldNames": "mag.process.Filter",
55
"WarnOnOldName": false
66
}
7-
}
7+
}

src/io/+mag/+io/+in/Format.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
% LOAD Load raw data from file.
1212
rawData = load(this, fileName)
13-
13+
1414
% PROCESS Process raw data and convert to common data
1515
% format.
1616
data = process(this, rawData, varargin)

src/mission/bart/+mag/+bart/+view/Spectrogram.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function visualize(this)
6868
end
6969

7070
if ~isempty(input2) && input2.HasData
71-
71+
7272
input2Spectrum = mag.spectrogram(input2, FrequencyLimits = this.FrequencyLimits, FrequencyPoints = this.FrequencyPoints, ...
7373
Normalize = this.Normalize, Window = this.Window, Overlap = this.Overlap);
7474

src/mission/imap/+mag/+imap/+view/Comparison.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function visualize(this)
6666

6767
primaryGraphs = this.generateComparisonGraph(primaryIALiRTComparison, "left");
6868
secondaryGraphs = this.generateComparisonGraph(secondaryIALiRTComparison, "right");
69-
69+
7070
this.Figures(end + 1) = this.Factory.assemble( ...
7171
primaryIALiRTComparison, primaryGraphs, secondaryIALiRTComparison, secondaryGraphs, ...
7272
Name = "Science vs. I-ALiRT (Closest Vector)", ...
@@ -89,7 +89,7 @@ function visualize(this)
8989

9090
primaryGraphs = this.generateComparisonGraph(primarySID5Comparison, "left");
9191
secondaryGraphs = this.generateComparisonGraph(secondarySID5Comparison, "right");
92-
92+
9393
this.Figures(end + 1) = this.Factory.assemble( ...
9494
primarySID5Comparison, primaryGraphs, secondarySID5Comparison, secondaryGraphs, ...
9595
Name = "Science vs. SID5 (Closest Vector)", ...

src/mission/imap/+mag/+imap/+view/Spectrogram.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function visualize(this)
9090

9191
transformation.FrequencyLimits = this.FrequencyLimits;
9292
transformation.FrequencyPoints = this.FrequencyPoints;
93-
transformation.Normalize = this.Normalize;
93+
transformation.Normalize = this.Normalize;
9494
transformation.Window = this.Window;
9595
transformation.Overlap = this.Overlap;
9696

src/mission/imap/resources/alias.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
"WarnOnOldName": true
4141
}
4242
]
43-
}
43+
}

src/utility/+mag/+buildtool/+task/PackageTask.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function packageToolbox(task, ~, version)
7373
function matlabPath = getMATLABPath()
7474

7575
matlabPath = string(split(path(), pathsep()));
76-
76+
7777
locMAG = contains(matlabPath, "MAG-Data-Visualization") & contains(matlabPath, ["app", "src"]);
7878
matlabPath = matlabPath(locMAG);
7979
end

src/utility/+mag/+internal/isThemeable.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function value = isThemeable(figure)
22
% ISTHEMEABLE Determine whether figure is themeable (i.e., if setting
33
% dark/light mode is supported).
4-
4+
55
arguments (Input)
66
figure (1, 1) matlab.ui.Figure
77
end

src/utility/+mag/+mixin/SaveLoad.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
methods (Hidden)
1616

1717
function savedObject = saveobj(this)
18-
18+
1919
savedObject = this;
2020
savedObject.OriginalVersion = this.Version;
2121
end

tests/system/app/tDataVisualization.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ function toolbarDebug_noError(testCase)
8282
end
8383

8484
% function selectMission(testCase, ValidMission)
85-
%
85+
%
8686
% % Set up.
8787
% app = testCase.createAppWithCleanup(ValidMission);
88-
%
88+
%
8989
% % Exercise.
9090
% testCase.press(app.ToolbarManager.MissionPushTool);
91-
%
91+
%
9292
% testCase.assertNotEmpty(app.SelectMissionDialog, "Mission selection dialog should not be empty.");
93-
%
93+
%
9494
% testCase.choose(app.SelectMissionDialog.MissionDropDown, ValidMission);
9595
% testCase.press(app.SelectMissionDialog.SelectButton);
96-
%
96+
%
9797
% % Verify.
9898
% testCase.verifyEqual(app.Mission, ValidMission, "Mission should be selected.");
9999
% end

0 commit comments

Comments
 (0)