MISS_HIT is several things, but most importantly it is a set of tools
that will make your code better (and hopefully your life easier)
if you are writing programs using the MATLAB, Simulink, or Octave
programming languages. To be honest, I wrote MISS_HIT out of
frustration, in that there is a huge MATLAB eco-system in industry, and
the code quality is generally poor as there is little to no tool-support
that is taken for granted in any other programming language. So MISS_HIT
attempts to fill the gaps with the following tools:
MH Style - A configurable style checker and code formatter
(sometimes also called code beautifier or pretty printer). It can
take any MATLAB or Octave code and fix e.g. indentation and other
MH Metrics - A code metrics tool, that can produce a variety
of complexity metrics for your code. It includes a justification
mechanism so that you can use this tool in CI, and HTML reports.
MH Lint - A bug-finding static analysis tool, that can detect
some questionable, ambiguous, or misleading constructs in your code.
MH Trace - simple tool to extrace tags from source
and tests to help demonstrate requirements traceability.
MH Copyright - A tool that can simplify maintaining and
updating copyright notices and docstrings in your code.
Please note that all these tools also support updating MATLAB code
embedded inside Simulink models.
The style checker can turn code like this:
function rv= foo (x), if x < 0,,rv=- x;else,rv=x;,; end;
Into something more readable:
function rv = foo (x)
if x < 0
rv = -x;
rv = x;
The easiest way to install it is to use the latest release published
$ pip3 install miss_hit
Then, you can style-check your program, by simply using:
There have been other attempts at this, but MISS_HIT tries to do
things differently (and I hope better). Specifically:
It is completely stand-alone. It does not require a working MATLAB
or Octave setup.
It is not just a bag of reg-ex, or a wrapper arounds some
undocumented MATLAB internals. It is based on a feature complete
lexer and parser, which supports
every single weird
of the MATLAB language.
It contains features specifically for huge industrial code-bases
(i.e. millions of lines): multi-threaded analysis and a
Designed for both interactive use during development, and
integration into modern CI environments.