3.5 Command Line Support for MISRA Check
MISRA Check support is available as a command line tool. See [AoU-07-MISRA].
Installation
- Install the latest MPLAB X IDE.
- Open a native command prompt (Windows, Linux and Mac) and navigate to the MPLAB X IDE installation's bin folder. For example, on Windows: C:\Program Files\Microchip\MPLABX\v6.0\mplab_platform\bin.
- The MISRA Check command line utility is available as
misracli.bat
(Windows) ormisracli.sh
(Linux/Mac).
Examples
The following examples use the Windows version misracli.bat
. For Linux/Mac use misracli.sh
.
Normal use
The MISRA Check command line interface will enable all
rules by default, but you can disable specific ones using the
–disable
option.
To get a full list of all the available MISRA Check command line interface options run:
C:\Program
Files\Microchip\MPLABX\[vX.XX]\mplab_platform\bin\misracli.bat
–help
misracli.bat myFile.c
runs MISRA Check on a single file and report errors in the output.misracli.bat myDirectory
runs MISRA Check recursively on all..c,.cpp,*
.cxx,.cc,.h,.hpp,.hxx
and*.hh
files under a given directory.misracli.bat
returns 0 if no errors are found and a non-zero value if errors are detected.
Special options
misracli.bat --help
lists all options with a description.misracli.bat --version
displays a version number.- Adding the option
--quiet
only displays warnings and errors (example: missing source files or incorrect use of--cppcheck param
). - Adding the option
--silent
disables all output (but the return value should be correct and it can be used together with reporting). - Using the option
--workdir=myDirectory
runs the analysis in another folder than the current working directory. - Using the option
--cppcheck="C:\Program Files\myCustomCppCheckInstallation\cppcheck.exe"
uses the user-installedcppcheck.exe
(available from cppcheck.sourceforge.io/).
Reporting
- Adding the option
--html=myReport.html
generates an html report. - Adding the option
--csv=myReport.csv
generates a csv report.
Rule handling
- Adding the option
--disable="1.2 1.3"
checks the files but disables checking of rule 1.2 and 1.3. - Adding the option
--nosuppression
disallows inlined code comments which otherwise would suppress rules.