Skip to content

Commit

Permalink
chore(injector): add lint check for injector C sources
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Dec 16, 2024
1 parent 3176e51 commit 7d8ccc4
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ golangci-lint: golangci-lint-install
@echo "-------------------------------- (linting Go code)"
$(GOLANGCI_LINT) run

.PHONY: golang-lint-fix
golang-lint-fix: golangci-lint-install
$(GOLANGCI_LINT) run --fix

.PHONY: helm-chart-lint
helm-chart-lint:
@echo "-------------------------------- (linting Helm charts)"
Expand Down Expand Up @@ -200,12 +204,28 @@ prometheus-crd-version-check:
@echo "-------------------------------- (verifying the Prometheus CRD version is in sync)"
./test-resources/bin/prometheus-crd-version-check.sh

.PHONY: c-lint-installed
c-lint-installed:
@set +x
@if ! clang-format --version > /dev/null; then \
echo "error: clang-format is not installed. Run 'brew install clang-format' or similar."; \
exit 1; \
fi

.PHONY: c-lint
c-lint: c-lint-installed
@echo "-------------------------------- (linting C source files)"
clang-format --dry-run --Werror images/instrumentation/injector/src/*.c

.PHONY: c-lint-fix
c-lint-fix: c-lint-installed
clang-format -i images/instrumentation/injector/src/*.c

.PHONY: lint
lint: golangci-lint helm-chart-lint shellcheck-lint prometheus-crd-version-check
lint: golangci-lint helm-chart-lint shellcheck-lint prometheus-crd-version-check c-lint

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix
lint-fix: golang-lint-fix c-lint-fix

##@ Build

Expand Down

0 comments on commit 7d8ccc4

Please sign in to comment.