A set of software tools and tech notes about embedded source code quality such as testing environments, static code analyzers, code beautifiers, among others.
Here are ways to run it:
# simple
$ uncrustify -c uncrustify.cfg module/*.h -l c
# with backup
$ uncrustify -c uncrustify.cfg module/*.h -l c --replace
# without backup
$ uncrustify -c uncrustify.cfg module/*.h -l c --no-backup
The -c
flag selects the configuration file.
Alternatively multiple or single files that should be processed can be
specified at the command end without flags.
If the flag --no-backup
is missing, every file saved with the initial
name and an additional suffix (can be changed with --suffix).
For more options descriptions call:
$ uncrustify -h
To ease the process a bit:
- Universal Indent GUI - A cross-platform graphical configuration file editor for many code beautifiers, including Uncrustify.
- uncrustify_config - A web configuration tool based on Uncrustifys emscripten interface.
- UncrustifyX - Uncrustify utility and documentation browser for Mac OS X
See this guide to get started with Infer. To run Infer, type the following in your terminal from the same directory as hello.c:
infer run -- gcc -c hello.c
To run Infer with a build system like CMake:
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
cd ..
infer run --compilation-database build/compile_commands.json
Alternatively, one can trick CMake into using infer instead of the system's compilers:
cd build
infer compile -- cmake ..
infer run -- make -j 4
Documentation and license info exists in the Ceedling's repository. You can use Ceedling from this Docker container.
The ceedling directory contains several templates to create testable modules using Ceedling. Each template has its own YAML file which indicates how to invoke Ceedling from a shell. The ceedling/template directory includes the templates listed below:
- moduleUnderTest: it might be applied to a regular C module
- rkh-sm-template: it might be applied to a RKH framework's active object. In this case the active object's state machine has been implemented through Sm.h, SmAct.h, Sm.c and SmAct.c files which are properly located in inc/ and src/ directories.
- rkh-sm-unified-template: it might be applied to a RKH framework's active object. In this case the active object's state machine has been implemented through Sm.h and Sm.c files which are located in inc/ and src/ directories respectively.
- sm-template: it might be applied to a state machine module
A Doxygen configuration file (Doxyfile) for developing C/C++ code is available in doxygen/ directory.
$ doxygen Doxygen # Execute it from a directory in which you will generate source code documentation
The file git-cheapsheet.md provides a simple Git cheap sheet. This file is located in git/ directory. Aditionally, this directory contains a couple of useful files for using Git in a C/C++ project such as .gitignore
A Vim configuration file (.vimrc) for developing C/C++ code is available in vim/ directory.
If you want to use a Docker container to develop your own code using Ceedling, you can clone codequality repository. This guide explains how to use this container from shell.