florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
160 stars 21 forks source link

complain about statements in Contents.m #203

Closed florianschanda closed 3 years ago

florianschanda commented 3 years ago

Files named Contents.m have special significance to the MATLAB help system. https://uk.mathworks.com/help/matlab/matlab_prog/create-a-help-summary-contents-m.html

MH Lint should ensure they contain nothing but comments.

Remi-Gau commented 3 years ago

Curious about one thing: Contents.m should be flagged as non conforming to the regex I have set up for function names.

Not sure I understand why it is is skipped?

florianschanda commented 3 years ago

If you don't have a function in your file, then MISS_HIT won't complain. Right now function naming is only checked for function declarations; but script files will be ignored. There should be two things happening, really:

florianschanda commented 3 years ago

I have created #205 and #206 for these.

florianschanda commented 3 years ago

So there already was an existing check that the class or function name has to match the filename. However I repurposed #206 that any filename shouldn't shadow a built-in, like true. There was an existing check for this to stop you doing false = 1; but I missed checking filenames.