remove pre-commit (#652)

* remove pre-commit

* cleanup

* fix codespell

* lil more

* lefthook

* lil more

* fix cpplint

* brew install has a ton of overhead

* speed up cppcheck
This commit is contained in:
Adeeb Shihadeh
2025-12-28 10:06:31 -08:00
committed by GitHub
parent 9eb3ce68f2
commit 4b3393aea9
6 changed files with 46 additions and 84 deletions

View File

@@ -1,27 +0,0 @@
name: repo
on:
schedule:
- cron: "0 15 1 * *"
workflow_dispatch:
jobs:
pre-commit-autoupdate:
name: pre-commit autoupdate
runs-on: ubuntu-latest
container:
steps:
- uses: actions/checkout@v3
- name: pre-commit autoupdate
run: |
git config --global --add safe.directory '*'
pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@5b4a9f6a9e2af26e5f02351490b90d01eb8ec1e5
with:
token: ${{ secrets.ACTIONS_CREATE_PR_PAT }}
commit-message: Update pre-commit hook versions
title: 'pre-commit: autoupdate hooks'
branch: pre-commit-updates
base: master
delete-branch: true

View File

@@ -1,45 +0,0 @@
files: ^msgq/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
- id: check-yaml
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.12
hooks:
- id: ruff
- repo: local
hooks:
- id: cppcheck
name: cppcheck
entry: cppcheck
language: system
types: [c++]
exclude: '^(msgq/msgq_tests.cc|msgq/test_runner.cc)'
args:
- --error-exitcode=1
- --inline-suppr
- --language=c++
- --force
- --quiet
- -j4
- --check-level=exhaustive
- repo: https://github.com/cpplint/cpplint
rev: 2.0.2
hooks:
- id: cpplint
args:
- --quiet
- --counting=detailed
- --linelength=240
- --filter=-build,-legal,-readability,-runtime,-whitespace,+build/include_subdir,+build/forward_decl,+build/include_what_you_use,+build/deprecated,+whitespace/comma,+whitespace/line_length,+whitespace/empty_if_body,+whitespace/empty_loop_body,+whitespace/empty_conditional_body,+whitespace/forcolon,+whitespace/parens,+whitespace/semicolon,+whitespace/tab,+readability/braces
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args:
- -L ned
- --builtins clear,rare,informal,usage,code,names,en-GB_to_en-US

32
lefthook.yml Normal file
View File

@@ -0,0 +1,32 @@
output:
- meta # Print lefthook version
- summary # Print summary block (successful and failed steps)
- empty_summary # Print summary heading when there are no steps to run
- success # Print successful steps
- failure # Print failed steps printing
- execution # Print any execution logs
#- execution_out # Print execution output
#- execution_info # Print `EXECUTE > ...` logging
- skips # Print "skip" (i.e. no files matched)
test:
parallel: true
commands:
# *** static analysis ***
ruff:
run: ruff check .
ty:
run: ty check .
codespell:
run: codespell {files} -L ned,stdio,master --builtin clear,rare,informal,usage,code,names,en-GB_to_en-US -S uv.lock,*_pyx.cpp,catch2*
files: git ls-tree -r HEAD --name-only
cppcheck:
run: cppcheck --error-exitcode=1 --inline-suppr --language=c++ --force --quiet -j4 --check-level=exhaustive $(git ls-files '*.cc' | grep -v -E '(msgq_tests|test_runner)\.cc')
cpplint:
run: cpplint --exclude=msgq/catch2/ --exclude=msgq/ipc_pyx.cpp --exclude=msgq/visionipc/visionipc_pyx.cpp --recursive --quiet --counting=detailed --linelength=240 --filter=-build,-legal,-readability,-runtime,-whitespace,+build/include_subdir,+build/forward_decl,+build/include_what_you_use,+build/deprecated,+whitespace/comma,+whitespace/line_length,+whitespace/empty_if_body,+whitespace/empty_loop_body,+whitespace/empty_conditional_body,+whitespace/forcolon,+whitespace/parens,+whitespace/semicolon,+whitespace/tab,+readability/braces msgq/
# *** tests ***
test_runner:
run: msgq/test_runner
pytest:
run: pytest

View File

@@ -15,7 +15,6 @@ dependencies = [
"setuptools", # for distutils "setuptools", # for distutils
"Cython", "Cython",
"scons", "scons",
"pre-commit",
"ruff", "ruff",
"parameterized", "parameterized",
"coverage", "coverage",
@@ -23,7 +22,10 @@ dependencies = [
"pytest", "pytest",
"pytest-retry", "pytest-retry",
"cppcheck", "cppcheck",
"cpplint",
"codespell",
"ty", "ty",
"lefthook",
] ]
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml # https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml

View File

@@ -8,8 +8,10 @@ PLATFORM=$(uname -s)
echo "installing dependencies" echo "installing dependencies"
if [[ $PLATFORM == "Darwin" ]]; then if [[ $PLATFORM == "Darwin" ]]; then
if ! command -v python3 &>/dev/null || ! pkg-config --exists libzmq 2>/dev/null; then
export HOMEBREW_NO_AUTO_UPDATE=1 export HOMEBREW_NO_AUTO_UPDATE=1
brew install python3 zeromq brew install python3 zeromq
fi
elif [[ $PLATFORM == "Linux" ]]; then elif [[ $PLATFORM == "Linux" ]]; then
# for AGNOS since we clear the apt lists # for AGNOS since we clear the apt lists
if [[ ! -d /"var/lib/apt/" ]]; then if [[ ! -d /"var/lib/apt/" ]]; then

16
test.sh
View File

@@ -1,20 +1,18 @@
#!/usr/bin/env bash #!/bin/bash
set -e set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR cd $DIR
# *** env setup ***
source ./setup.sh source ./setup.sh
# *** build *** # *** build ***
scons -j8 scons -j8
# *** lint *** # *** lint + test ***
ty check . lefthook run test
#ruff check .
pre-commit run --all-files
# *** test *** # *** all done ***
msgq/test_runner GREEN='\033[0;32m'
pytest NC='\033[0m'
printf "\n${GREEN}All good!${NC} Finished build, lint, and test in ${SECONDS}s\n"