Skip to content

Command‐Line Flags

Joshua1023 edited this page Jul 31, 2024 · 3 revisions

This page will introduce some useful command-line flags of misra_analyzer.

src_dir

src_dir is the path to the directory to be checked in the working environment. It supports both absolute and relative formats. A relative path will be converted to an absolute one by adding the relative part to the path where misra_analyzer is executed.

Note: If misra_analyzer is running in the container, src_dir should be the path in the container instead of the exact path of the project to be checked.

We prepared subproject-demo for an example.

If you want to check a subproject instead of the whole project, src_dir can be used to set the path of the subproject:

podman pull ghcr.io/naivesystems/analyze:latest

mkdir -p output

podman run --rm \
  -v $PWD:/src:O \
  -v $PWD/.naivesystems:/config:Z \
  -v $PWD/output:/output:Z \
  -w /src/ \
  ghcr.io/naivesystems/analyze:latest \
  /opt/naivesystems/misra_analyzer --src_dir demo/ -show_results

ignore_dir

ignore_dir is used to skip the analysis of certain folders or files. It follows the doublestar pattern (https://github.com/bmatcuk/doublestar#patterns). If you want to ignore the file ignored.c, you can use the pattern **/ignored.c. If you want to use several patterns, you can use ignore_dir more than once.

For example, all header files and demo_ctu.c will be skipped during the analysis:

podman run --rm \
  -v $PWD:/src:O \
  -v $PWD/.naivesystems:/config:Z \
  -v $PWD/output:/output:Z \
  ghcr.io/naivesystems/analyze:master \
  /opt/naivesystems/misra_analyzer -show_results -ignore_dir=**/demo_ctu.c -ignore_dir=**/*.h

TODO: more command-line flags