Skip to content

Commit 60b1905

Browse files
HanSur94claude
andcommitted
ci: add MISS_HIT MATLAB linter to test pipeline
- Add lint job running mh_style and mh_lint on every push/PR - Add miss_hit.cfg with MATLAB-compatible naming rules and suppressions for existing codebase style - Fix consecutive blank lines in 9 files to pass clean Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 86dfd48 commit 60b1905

11 files changed

Lines changed: 50 additions & 15 deletions

File tree

.github/workflows/tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13+
lint:
14+
name: MATLAB Lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install MISS_HIT
20+
run: pip install miss_hit
21+
22+
- name: Run style checker
23+
run: mh_style libs/ tests/ examples/
24+
25+
- name: Run linter
26+
run: mh_lint libs/ tests/ examples/
27+
1328
octave:
1429
name: Octave Tests
1530
if: github.event_name != 'schedule'

examples/example_stress_test.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@
260260
fprintf(' Total time: %.2f seconds\n', totalTime);
261261
fprintf(' Toolbar: cursor, crosshair, grid, legend, autoscale, export\n');
262262

263-
264263
% =========================================================================
265264
% Helper functions
266265
% =========================================================================

libs/FastPlot/FastPlotDataStore.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,6 @@ function initBinaryFallback(obj, x, y)
808808
end
809809
end
810810

811-
812811
function tf = isCategoricalStruct(data)
813812
%ISCATEGORICALSTRUCT True if data is a struct with codes+categories fields.
814813
tf = isstruct(data) && isfield(data, 'codes') && isfield(data, 'categories');

libs/FastPlot/build_mex.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ function build_mex()
216216
copy_mex_to(outDir, sensorPrivDir, 'resolve_disk_mex');
217217
end
218218

219-
220219
function compile_mex(src_file, out_name, outDir, include_flag, opt_flags, compiler, extra_srcs)
221220
%COMPILE_MEX Compile C source file(s) into a MEX binary.
222221
% compile_mex(src_file, out_name, outDir, include_flag, opt_flags, compiler, extra_srcs)
@@ -278,7 +277,6 @@ function compile_mex(src_file, out_name, outDir, include_flag, opt_flags, compil
278277
end
279278
end
280279

281-
282280
function copy_mex_to(srcDir, destDir, name)
283281
%COPY_MEX_TO Copy a compiled MEX binary to another directory.
284282
% copy_mex_to(srcDir, destDir, name) finds all files matching
@@ -303,7 +301,6 @@ function copy_mex_to(srcDir, destDir, name)
303301
end
304302
end
305303

306-
307304
function [gcc_path, gcc_name] = find_gcc()
308305
%FIND_GCC Search for a real GCC installation (not Apple Clang).
309306
% [gcc_path, gcc_name] = find_gcc() searches Homebrew paths for
@@ -343,5 +340,3 @@ function copy_mex_to(srcDir, destDir, name)
343340
gcc_name = 'gcc';
344341
end
345342
end
346-
347-

libs/FastPlot/private/lttb_downsample.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
yOut = yOut(1:pos);
127127
end
128128

129-
130129
function [xOut, yOut] = lttb_core(x, y, numOut, logX, logY)
131130
%LTTB_CORE Core LTTB algorithm on a contiguous (no NaN) segment.
132131
% [xOut, yOut] = LTTB_CORE(x, y, numOut, logX, logY) performs the

libs/FastPlot/private/minmax_downsample.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@
158158
yOut = yOut(1:pos);
159159
end
160160

161-
162161
function [xOut, yOut] = minmax_core(segX, segY, nb)
163162
%MINMAX_CORE Vectorized min/max downsampling of a contiguous segment.
164163
% [xOut, yOut] = MINMAX_CORE(segX, segY, nb) performs min/max envelope
@@ -246,7 +245,6 @@
246245
yOut(even(~minFirst)) = yMinVals(~minFirst);
247246
end
248247

249-
250248
function [xOut, yOut] = minmax_core_logx(segX, segY, nb)
251249
%MINMAX_CORE_LOGX Min/max downsampling with logarithmically-spaced buckets.
252250
% [xOut, yOut] = MINMAX_CORE_LOGX(segX, segY, nb) performs min/max

libs/SensorThreshold/private/mergeResolvedByLabel.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
end
125125
end
126126

127-
128127
function [stepX, stepY] = toStepFunction(segBounds, values, dataEnd)
129128
%TOSTEPFUNCTION Convert segment boundary values to step-function arrays.
130129
% [stepX, stepY] = TOSTEPFUNCTION(segBounds, values, dataEnd) transforms

miss_hit.cfg

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# MISS_HIT configuration for FastPlot
2+
# https://florianschanda.github.io/miss_hit/
3+
4+
# Line length — MATLAB convention
5+
line_length: 160
6+
7+
# Tab width
8+
tab_width: 4
9+
10+
# Naming conventions — match MATLAB/OOP PascalCase style
11+
regex_class_name: "[A-Z][a-zA-Z0-9]+"
12+
regex_function_name: "[a-zA-Z][a-zA-Z0-9_]*"
13+
regex_method_name: "[a-zA-Z][a-zA-Z0-9_]*"
14+
regex_parameter_name: "[a-zA-Z][a-zA-Z0-9_]*"
15+
regex_script_name: "[a-zA-Z][a-zA-Z0-9_]*"
16+
17+
# Suppress noisy rules for existing codebase
18+
suppress_rule: "copyright_notice"
19+
suppress_rule: "unicode"
20+
suppress_rule: "end_of_statements"
21+
suppress_rule: "whitespace_around_functions"
22+
suppress_rule: "indentation"
23+
suppress_rule: "naming_functions"
24+
suppress_rule: "whitespace_comments"
25+
suppress_rule: "whitespace_comma"
26+
suppress_rule: "operator_whitespace"
27+
suppress_rule: "whitespace_keywords"
28+
suppress_rule: "operator_after_continuation"
29+
suppress_rule: "whitespace_continuation"
30+
suppress_rule: "file_length"
31+
suppress_rule: "spurious_row_semicolon"
32+
suppress_rule: "whitespace_semicolon"
33+
suppress_rule: "whitespace_colon"
34+
suppress_rule: "whitespace_brackets"
35+
suppress_rule: "whitespace_assignment"

tests/run_all_tests.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
end
2121
end
2222

23-
2423
function results = run_matlab_suite(test_dir)
2524
%RUN_MATLAB_SUITE Run class-based test suite using matlab.unittest.
2625
import matlab.unittest.TestSuite
@@ -71,7 +70,6 @@
7170
end
7271
end
7372

74-
7573
function results = run_octave_tests(test_dir)
7674
%RUN_OCTAVE_TESTS Run function-based tests for Octave compatibility.
7775
add_fastplot_private_path();

tests/test_mex_parity.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ function test_mex_parity()
138138
fprintf(' All %d MEX parity tests passed.\n', n_passed);
139139
end
140140

141-
142141
% ---- Pure MATLAB reference implementations (copied from private/) ----
143142

144143
function idx = binary_search_matlab(x, val, direction)

0 commit comments

Comments
 (0)