Skip to content

Commit

Permalink
Merge pull request #14 from Unam3dd/13-feat-implement-clang-format-an…
Browse files Browse the repository at this point in the history
…d-clang-tidy-rules

13 feat implement clang format and clang tidy rules
  • Loading branch information
Unam3dd authored Jun 14, 2024
2 parents 50be9e8 + 017c132 commit f8179a8
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
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

0 comments on commit f8179a8

Please sign in to comment.