Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/yezzey-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ jobs:
run: |
make -f Makefile.tidy tidy-check

cppcheck:
name: cppcheck (static analysis)
runs-on: ubuntu-latest
container:
image: neszl/cppcheck:latest
steps:
- name: Checkout Yezzey source
uses: actions/checkout@v4

- name: Run cppcheck
shell: bash
run: |
make -f Makefile.cppcheck cppcheck-check

unit-tests:
name: Unit Tests (googletest)
runs-on: ubuntu-latest
Expand Down
23 changes: 23 additions & 0 deletions Makefile.cppcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CPPCHECK ?= cppcheck
CPPCHECK_IMAGE ?= neszl/cppcheck:latest

CPPCHECK_FILES := $(wildcard src/*.cpp) $(wildcard *.c) $(wildcard include/*.h)

CPPCHECK_FLAGS := -std=c++11 -I include -I lib -DGPBUILD -D_GNU_SOURCE --enable=warning,style,performance \
--suppress=missingIncludeSystem --inline-suppr --error-exitcode=1

.PHONY: cppcheck cppcheck-check cppcheck-docker cppcheck-check-docker

cppcheck:
@$(CPPCHECK) $(CPPCHECK_FLAGS) $(CPPCHECK_FILES) 2>&1 || true

cppcheck-check:
@$(CPPCHECK) $(CPPCHECK_FLAGS) $(CPPCHECK_FILES)

cppcheck-docker:
docker run --rm -v "$(CURDIR)":/src -w /src $(CPPCHECK_IMAGE) \
sh -c 'make -f Makefile.cppcheck cppcheck'

cppcheck-check-docker:
docker run --rm -v "$(CURDIR)":/src -w /src $(CPPCHECK_IMAGE) \
sh -c 'make -f Makefile.cppcheck cppcheck-check'
Loading