MATLAB is a popular programming language in many engineeringdisciplines, intended for the fast development of prototypes. But aswe all know, prototypes make it into production all the time, so nowyou're stuck. Unfortunately, there are no style checkers or "good"static analysis tools for MATLAB. This project attempts to fill thisgap.
If you have MATLAB (or MATLAB embedded in Simulink models) in yourproduction code and want to improve code quality then this tool-suiteis for you.
MISS_HIT comes with the following tools, all of which come with usermanuals and setup instructions:https://florianschanda.github.io/miss_hit/
Style Checker mh_style
A simple coding style checker and code formatter for MATLAB orOctave code, including MATLAB embedded inside Simulink models.
Code Metrics mh_metric
A simple code metric tool for MATLAB or Octave code, includingMATLAB embedded inside Simulink models.
Bug finding mh_lint
A simple linter for MATLAB or Octave code, includingMATLAB embedded inside Simulink models.
Code/Test traceability mh_trace
A simple tool to extrace tags from test and code to demonstraterequirements traceability.
Diff helper mh_diff
A tool for diffing MATLAB code inside Simulink models. Note thatother changes (e.g. different connections) are not detected; this isonly working for embedded MATLAB.
Copyright notice helper mh_copyright
A tool that can update or adjust copyright notices in bulk. Helpfulif your company changes name, or you have year ranges that needupdating.
Please refer to the release notesfor a summary of recent changes and known issues.
We intend to provide more tools later, please refer to theroadmapfor more information.
$ pip3 install --user miss_hit
This installation also adds five executable scripts mh_style
,mh_metric
, mh_lint
, mh_copyright
, and mh_diff
into.local/bin
, so please make sure that this is on your PATH
.
You can also use the python -m
syntax to directly invoke theprogram. This might be useful if you're on a heavily locked-downcorporate Windows environment:
$ python3 -m miss_hit.mh_style
To use MISS_HIT you just give it a set of files or directories toprocess, for example:
$ mh_style my_file.m
$ mh_style --process-slx my_model.slx
$ mh_style src/
Configuration and setup is described in theuser manuals
It is recommended to use pip, as that gets you the latest stablerelease. However, it is possible to directly use MISS_HIT from acheckout. MISS_HIT does not require any python packages orlibraries. Just check out the repository and put it on yourpath. That's it.
The version of Python I am using is 3.6
but any later version shouldalso work. I am not using any overly fancy language features.
If you want to help develop you will need Linux as the test-suitedoesn't really work on Windows. You will also need Pylint,PyCodeStyle, Coverage, and Graphviz. Install as follows:
$ apt-get install graphviz
$ pip3 install --user --upgrade pylint pycodestyle coverage
For publishing releases (to GitHub and PyPI) you will also need:
$ pip3 install --user --upgrade setuptools wheel requests
There are serious issues present in the MATLAB and Octave languages onall levels (lexical structure, parsing, and semantics) that make itvery difficult to create any tool processing them. In fact, GitHub islittered with incomplete attempts and buggy parsers. The usualquestion is "but what about Octave?"; it is a similar language, but itis not compatible with MATLAB. If your problem is parsing MATLAB thenthe Octave parser will not help you. Even very simple statements suchas x = [1++2]
mean different things (3
in MATLAB, syntax error inOctave).
I have documented the keyissueswe've faced and how we've resolved them.
The basic framework, style checker and code metrics tool of MISS_HIT(everything under miss_hit_core
) are licensed under the GNU GPLversion 3 (or later) as described inLICENSE.
The advanced analysis tools of MISS_HIT (everything under miss_hit
)are licensed under the GNU Affero GPL version 3 (or later) asdescribed inLICENSE.AGPL.
The vast majority of this work is (C) Florian Schanda. Contributionsfrom the following people and entities are under their copyright, withthe same license:
This project includes modified/adapted parts of the GNU Octavetestsuite under tests/parser/octave_*
. These are (c) their originalauthors. Each file there describes from which file they derive.
Some of the parser tests include code samples and documentationsnippets from the publicly available MathWorks website. Anattribution (in comment form) is always included in these cases.
The documentation usesfeather iconswhich are licensed under the MIT License.
1.L1 CACHE的Miss和Hit 1.1 Read Miss 见2.1。 1.2 Write Miss L1D是Read-allocate CACHE,意味着仅在发生Read Miss时才会读入新的行。如果写Miss发生,数据通过一个Write Buffer写到低一级内存,从而把L1D CACHE旁路。写buffer包含4个entries,每个entry是64位宽。 1.3 Write Hi
192.168.10.139 - - [15/Dec/2011:16:49:37 +0800] "GET http://www.jian.com/p_w_picpaths/shufa.jpg HTTP/1.0" 200 95900 "-" "Wget/1.11.4 Red Hat modified" TCP_HIT:NONE 192.168.10.139 - - [15/Dec/2011:16:4
击中或没打中 Hit-or-Miss/Hit-and-Miss 目标 在本教程中,您将学习如何使用Hit-or-Miss变换(也称为Hit-and-Miss变换)在二进制映像中查找给定的配置或模式。此转换也是更高级的形态学操作(例如稀疏或修剪)的基础。 我们将使用OpenCV函数morphologyEx()。 Hit-or-Miss理论 形态运算符根据其形状处理图像。这些运算符将一个或多个结构元素
Hit/Miss Ratios Here are some scripts related to Hit/Miss Ratios . Buffer Hit Ratio BUFFER HIT RATIO NOTES: Consistent Gets - The number of accesses made to the block buffer to retrieve data in a cons
Oracle - Hit/Miss Ratios Here are some scripts related to Hit/Miss Ratios . Buffer Hit Ratio BUFFER HIT RATIO NOTES: Consistent Gets - The number of accesses made to the block buffer to retrieve data