miss_hit
miss_hit copied to clipboard
new rule: imports, globals and persistent before code
What kind of feature is this?
- New feature in MISS_HIT
MISS_HIT component affected
- Style checker
Describe the solution you'd like Global and persistent variables shall be declared first in functions.
However they need to be after any argument validation blocks, so a function should be ordered like this:
- Argument validation blocks (only in matlab 2019b)
- imports
- global
- persistent
- function body
- nested functions
@niklasnylen an update this ticket (and similar ones that would do code re-structuring beyond adding whitespace and deleting stuff).
I plan to create another tool mh_reformat
that is a much more advanced code reformatting tool. It does not produce messages like mh_style; but instead just pretty prints code.
I suspect I will also remove the autofixing from mh_style
once this works. In the future mh_style will only complain :)
The reason for this is largely technical / and developer (i.e. me) sanity. The code that does the fixing has become so complicated that adding new functionality is just not practical any more. :/