I'm trying to build a system for enforcing coding standards on m-files in our code repository. To accomplish this, I'm creating a Matlab script that can run from the command line that will check all the files and report anomalies to the standard (exiting with exit(0) if everything is ok and with exit(1) if there are problems... will be part of a continuous integration runner).
One of the elements of our standard is that the mlint must be clean. This is pretty easily checked with Matlab's build-in checkcode function.
Another element of the standard is that indentation follows the recommendations of the Matlab editor smart indentation tool. This is proving harder to check programatically. I'd like to find a way to see if the standard indentation is being followed, i.e. if I were to run the smart indentation from the Matlab editor ( ctrl-a, ctrl-i ), would any part of the file change?
Are there ways to programatically run Matlab editor commands on m-files, something that could be used to recursively run smart indentation on all files in a folder structure?
Also, I'm barking up the wrong wrong tree entirely? Are there existing coding standard enforcement packages for Matlab (something like clang-tidy in c++) that I could be using instead?