Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13 feat implement clang format and clang tidy rules #14

Merged
merged 10 commits into from
Jun 14, 2024
9 changes: 9 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
Checks: 'readability-function-size, readability-math-missing-parentheses, readability-duplicate-include'
WarningsAsErrors: '.*'

CheckOptions:
- key: readability-function-size.LineThreshold
value: '25'
- key: readability-function-size.ParameterThreshold
value: '5'
38 changes: 38 additions & 0 deletions .github/workflows/norm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Norm

on: [push, pull_request]

permissions:
contents: read

jobs:
norm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository ${{ github.repository }} on a branch ${{ github.ref_name }} triggered by ${{ github.event_name }}
uses: actions/checkout@v4

- run: "echo the ${{ github.repository }} has been cloned in the container !"

- name: 🔄 Installing task...
uses: arduino/setup-task@v2
with:
version: 3.x

- uses: actions/setup-python@v5

- name: 🔄 Installing Meson package build system...
run: pip install meson

- name: 🔄 Installing Dependencies...
run: |
echo "📦 Installing libcriterion-dev, Ninja"
sudo apt-get update && sudo apt-get install -y libcriterion-dev ninja-build clang-tidy
echo "✅ Dependencies installed!"

- name: Run build release task...
run: |
echo "🏗️ Setting up Meson build system..."
task build
echo "🔄 Check the Norm..."
task norm
10 changes: 10 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ tasks:
silent: true
desc: "Build the project in release build in stripped mode"

norm:
platforms: ["linux"]
preconditions:
- sh: 'test -d build'
msg: "Norm required compile_commands.json files please build the project before !"
cmds:
- CLANG_TIDY=$(clang-tidy -p ./build src/**/*.c | grep "warning"); [[ ! -z "$CLANG_TIDY" ]] && echo $CLANG_TIDY && exit 1 || exit 0;
silent: true
desc: "Pass the norm on the project"

build-dev:
preconditions:
- sh: '{{if eq OS "windows"}} powershell.exe -Command Test-Path dist {{else}} test ! -d dist {{end}}'
Expand Down
Loading