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.cruns MISRA Check on a single file and report errors in the output.misracli.bat myDirectoryruns MISRA Check recursively on all..c,.cpp,*.cxx,.cc,.h,.hpp,.hxxand*.hhfiles under a given directory.misracli.batreturns 0 if no errors are found and a non-zero value if errors are detected.
Special options
misracli.bat --helplists all options with a description.misracli.bat --versiondisplays a version number.- Adding the option
--quietonly displays warnings and errors (example: missing source files or incorrect use of--cppcheck param). - Adding the option
--silentdisables all output (but the return value should be correct and it can be used together with reporting). - Using the option
--workdir=myDirectoryruns 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.htmlgenerates an html report. - Adding the option
--csv=myReport.csvgenerates 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
--nosuppressiondisallows inlined code comments which otherwise would suppress rules.
