Skip to content

Commit

Permalink
chore: remove clang-format
Browse files Browse the repository at this point in the history
Our configuration file for clang-format was taken from the Linux Kernel and thus was GPL
licensed. This is incompatible with CNCF requirements and therefore we need to remove it
before graduation. Since this invalidates our clang-format lints, let's just remove them
entirely until we can figure out what to do next.

Signed-off-by: William Findlay <[email protected]>
  • Loading branch information
willfindlay authored and jrfastab committed Jul 4, 2023
1 parent cf8c11c commit f1f09d4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 159 deletions.
120 changes: 0 additions & 120 deletions .clang-format

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/static-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ jobs:
make vendor
echo "git status --porcelain:" `git status --porcelain`
test -z "$(git status --porcelain)" || (echo "Module vendoring checks failed. Please run 'make vendor', and submit your changes"; exit 1)
- name: Build clang-format Docker image
run: |
docker build -f Dockerfile.clang-format -t "isovalent/clang-format:latest" .
- name: Verify clang-format on BPF code
id: clang_format
run: |
set -o pipefail
find bpf -name '*.c' -o -name '*.h' -not -path 'bpf/include/vmlinux.h' \
-not -path 'bpf/include/api.h' -not -path 'bpf/libbpf/*' | xargs -n 1000 \
docker run -v $(realpath .):/tetragon "isovalent/clang-format:latest" --Werror -n -style=file
if [ $? != 0 ]; then
echo "clang-format checks failed. Please run 'make format' and submit your changes."; exit 1
fi
- name: Build CLI release binaries
run: |
make cli-release
Expand Down
11 changes: 0 additions & 11 deletions Dockerfile.clang-format

This file was deleted.

17 changes: 2 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ BINDIR ?= /usr/local/bin
CONTAINER_ENGINE ?= docker
DOCKER_IMAGE_TAG ?= latest
LOCAL_CLANG ?= 0
LOCAL_CLANG_FORMAT ?= 0
FORMAT_FIND_FLAGS ?= -name '*.c' -o -name '*.h' -not -path 'bpf/include/vmlinux.h' -not -path 'bpf/include/api.h' -not -path 'bpf/libbpf/*'
NOOPT ?= 0
CLANG_IMAGE = quay.io/cilium/clang:aeaada5cf60efe8d0e772d032fe3cc2bc613739c@sha256:b440ae7b3591a80ffef8120b2ac99e802bbd31dee10f5f15a48566832ae0866f
Expand Down Expand Up @@ -88,9 +87,8 @@ help:
@echo ' generate - generate kubebuilder files'
@echo 'Linting and chores:'
@echo ' vendor - tidy and vendor Go modules'
@echo ' clang-format - run code formatter on BPF code'
@echo ' go-format - run code formatter on Go code'
@echo ' format - convenience alias for clang-format and go-format'
@echo ' format - convenience alias for go-format'
@echo 'Documentation:'
@echo ' docs - preview documentation website'

Expand Down Expand Up @@ -327,23 +325,12 @@ copy-golangci-lint:
docker cp ${xid}:/usr/bin/golangci-lint bin/golangci-lint
docker rm ${xid}

.PHONY: clang-format
ifeq (1,$(LOCAL_CLANG_FORMAT))
clang-format:
find bpf $(FORMAT_FIND_FLAGS) | xargs -n 1000 clang-format -i -style=file
else
clang-format:
$(CONTAINER_ENGINE) build -f Dockerfile.clang-format -t "cilium/clang-format:${DOCKER_IMAGE_TAG}" .
find bpf $(FORMAT_FIND_FLAGS) | xargs -n 1000 \
$(CONTAINER_ENGINE) run -v $(shell realpath .):/tetragon "cilium/clang-format:${DOCKER_IMAGE_TAG}" -i -style=file
endif

.PHONY: go-format
go-format:
find . -name '*.go' -not -path './vendor/*' -not -path './api/vendor/*' -not -path './pkg/k8s/vendor/*' -not -path './api/v1/tetragon/codegen/*' | xargs gofmt -w

.PHONY: format
format: go-format clang-format
format: go-format

# generate cscope for bpf files
cscope:
Expand Down

0 comments on commit f1f09d4

Please sign in to comment.