Created By: Michael Wrona
A collection of C++20 math utilities for MicWro Engineering projects. I add new utilities on an "as-required" basis.
Below are instruction for getting the project set up.
I highly recommend using a VS Code Dev Container for the project. It will install all required dependencies and set up an Ubuntu dev environment - easy-peasy. Dev Containers require Docker, so make sure you have it installed on your system beforehand.
Install the VS Code Dev Containers extension. Open the Command Palette and run "Dev Containers: Reopen in Container..." to launch the Dev Container.
Install pre-commit hooks.
pre-commit install
sudo apt update
sudo apt install -y build-essential cmake git python3 python3-pip cppcheck clang-tidy
python3 -m pip install -r .devcontainer/requirements.txt
pre-commit install
This project gets compiled into a shared library build/lib/libmathutils.so
.
VS Code build tasks are configured for this project. They can be run with CTRL+SHIFT+B
. Select between debug and release builds.
bash scripts/build-debug.sh
bash scripts/build-release.sh
Unit tests created with Google Test are included in the project. In the context of math utilities, tests are useful for verifying functions produce correct results. Unit tests also ensure changes "here" don't affect things "over there." Try to make at least one test for every utility.
I require pull requests to pass all tests.
# run tests
cd build/
ctest
I use pre-commit to run tasks such as removing trailing whitespace, ensuring structured text files are parsable, etc. See .pre-commit-config.yaml
for the complete list of tasks.
I require pull requests to pass pre-commit checks.
# install pre-commit hooks into the repo
pre-commit install
I use cppcheck and clang-tidy for static analysis. I require pull requests to pass cppcheck style
and warning
checks. Releases must pass clang-tidy checks. See .clang-tidy
for the list of checks.
# run cppcheck
bash scripts/run-cppcheck.sh
# run clang-tidy
bash scripts/run-clang-tidy.sh
I use pmccabe to compute function cyclomatic complexity and line counts. I try to keep function complexity below 15.
# run pmccabe
bash scripts/run-pmccabe.sh
The code repo can be found here.
git clone https://github.com/michaelwro/math-utils.git