Skip to content

michaelwro/math-utils

Repository files navigation

Math Utilities

GitHub tag Build & Test Static Analysis Coverage Status pre-commit License

Created By: Michael Wrona

A collection of C++20 math utilities for MicWro Engineering projects. I add new utilities on an "as-required" basis.

Getting Started

Below are instruction for getting the project set up.

Dev Container Setup (Prefered)

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

Manually Install Dependencies

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

Build Instructions

This project gets compiled into a shared library build/lib/libmathutils.so.

VS Code Build Tasks (Preferred)

VS Code build tasks are configured for this project. They can be run with CTRL+SHIFT+B. Select between debug and release builds.

Build Scripts

bash scripts/build-debug.sh
bash scripts/build-release.sh

Doxygen Site

View site - GH Pages

Dev Workflow

Unit Tests

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

Pre-Commit

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

Static Analysis

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

Complexity

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

Repository

The code repo can be found here.

git clone https://github.com/michaelwro/math-utils.git

About

Math utilities for MicWro engineering projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •