florianschanda / miss_hit

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

Invalid error for keyword `arguments` #290

Open pvogt09 opened 3 months ago

pvogt09 commented 3 months ago

MISS_HIT Component affected Please choose one from:

Your MATLAB/Octave environment

Your operating system and Python version

Describe the bug The file

 function [] = test()
    a = 0;
    arguments = struct(...
        'test', 1.0...
    );
end

gives the error

In arguments.m, line 3
|     arguments = struct(...
|     ^^^^^^^^^ error: expected valid statement, found keyword 'arguments' instead
MISS_HIT Style Summary: 1 file(s) analysed, 1 error(s)

which should not be the case because it is allowed to have variables called arguments as long as the keyword does not appear as the first expression in the function body (a = 0; makes the difference here between invalid Matlab syntax and correct code).

florianschanda commented 2 weeks ago

This one is going to be annoying to fix. I am looking into it.