Skip to content
Draft
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
1 change: 1 addition & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
npm install -g markdownlint-cli
pip install --user yamllint codespell
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0
go install github.com/checkmake/checkmake/cmd/checkmake@latest

- name: Cache Rust dependencies
uses: actions/cache@v4
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ repos:
files: \.go$
pass_filenames: false

- repo: local
hooks:
- id: makefile-lint
name: makefile lint
entry: make mkcheck
language: system
files: \.mk$
pass_filenames: false

# Markdown specific hooks
- repo: local
hooks:
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile.precommit
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ RUN pip install --break-system-packages shellcheck-py

# Golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.5.0

# Makefile Check
RUN go install github.com/checkmake/checkmake/cmd/checkmake@latest
2 changes: 2 additions & 0 deletions tools/linter/makefile/checkmake.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[maxbodylength]
maxBodyLength = 8
6 changes: 5 additions & 1 deletion tools/make/linter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ shellcheck: ## Lint all shell scripts in the project
exit 1; \
fi
@echo "Running shellcheck with config from tools/linter/shellcheck/.shellcheckrc"
@shellcheck -e SC2155,SC2034,SC1091 $(shell find . -type f -name "*.sh" -not -path "./node_modules/*" -not -path "./website/node_modules/*" -not -path "./dashboard/frontend/node_modules/*" -not -path "./models/*" -not -path "./.venv/*")
@shellcheck -e SC2155,SC2034,SC1091 $(shell find . -type f -name "*.sh" -not -path "./node_modules/*" -not -path "./website/node_modules/*" -not -path "./dashboard/frontend/node_modules/*" -not -path "./models/*" -not -path "./.venv/*")

mkcheck: ## Lint all Makefiles in the project
@$(LOG_TARGET)
checkmake --config=tools/linter/makefile/checkmake.ini tools/make/**/*.mk
4 changes: 2 additions & 2 deletions tools/make/pre-commit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ precommit-install:

precommit-check: ## Run pre-commit checks on all relevant files
precommit-check:
@FILES=$$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.sh" -o -name "*.md" -o -name "*.yaml" -o -name "*.yml" \) \
@FILES=$$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.sh" -o -name "*.md" -o -name "*.yaml" -o -name "*.yml" -o -name "*.mk" \) \
! -path "./target/*" \
! -path "./candle-binding/target/*" \
! -path "./website/node_modules/*" \
Expand All @@ -24,7 +24,7 @@ precommit-check:
echo "Running pre-commit on files: $$FILES"; \
pre-commit run --files $$FILES; \
else \
echo "No Go, Rust, JavaScript, Shell, Markdown, Yaml, or Python files found to check"; \
echo "No Go, Rust, JavaScript, Shell, Markdown, Yaml, Makefile,or Python files found to check"; \
fi

# Run pre-commit hooks in a Docker container,
Expand Down
Loading