Skip to content

Commit

Permalink
Add clangd configuration for libs-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Molter73 committed Sep 12, 2023
1 parent 29d67d0 commit 51397b1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions falco-libs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clangd.yaml
14 changes: 11 additions & 3 deletions falco-libs/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
FALCO_BUILDER_FLAVOR ?= fedora

.PHONY: clang-config
clang-config:
envsubst < $(CURDIR)/clangd.tpl.yaml > $(CURDIR)/clangd.yaml

.PHONY: clean
clean:
rm -f $(CURDIR)/clangd.yaml

.PHONY: build
build:
build: clang-config
docker build \
--tag quay.io/mmoltras/devcontainers:falco-libs-$(FALCO_BUILDER_FLAVOR) \
-f $(CURDIR)/$(FALCO_BUILDER_FLAVOR).Dockerfile \
Expand All @@ -16,11 +24,11 @@ deploy: build
$(CURDIR)/format-spec.sh | kubectl apply -f -

.PHONY: teardown
teardown:
teardown: clean
$(CURDIR)/format-spec.sh | kubectl delete -f -

.PHONY: docker-teardown
docker-teardown:
docker-teardown: clean
docker rm -f libs-builder

.PHONY: docker-deploy
Expand Down
21 changes: 21 additions & 0 deletions falco-libs/clangd.tpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CompileFlags:
CompilationDatabase: $GOPATH/github.com/falcosecurity/libs/build/
Diagnostics:
ClangTidy:
Add:
- bugprone*
- cppcoreguidelines*
- modernize*
- performance*
- readability*
Remove:
- readability-identifier-length
- modernize-use-nodiscard
- modernize-use-trailing-return-type
---
If:
PathMatch: .*Test\.cpp
Diagnostics:
ClangTidy:
Remove:
- bugprone-suspicious-include
1 change: 1 addition & 0 deletions falco-libs/debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ RUN mkdir -p /etc/apt/keyrings && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY clangd.yaml /root/.config/clangd/config.yaml
COPY compile-falco.sh /usr/bin/
1 change: 1 addition & 0 deletions falco-libs/fedora.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ RUN dnf config-manager --add-repo \
dnf install -y docker-ce-cli && \
dnf clean all

COPY clangd.yaml /root/.config/clangd/config.yaml
COPY compile-falco.sh /usr/bin/

0 comments on commit 51397b1

Please # to comment.