mirror of
https://github.com/commaai/msgq.git
synced 2026-06-08 05:54:44 +08:00
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:
27
.github/workflows/repo.yml
vendored
27
.github/workflows/repo.yml
vendored
@@ -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
|
||||
@@ -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
32
lefthook.yml
Normal 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
|
||||
@@ -15,7 +15,6 @@ dependencies = [
|
||||
"setuptools", # for distutils
|
||||
"Cython",
|
||||
"scons",
|
||||
"pre-commit",
|
||||
"ruff",
|
||||
"parameterized",
|
||||
"coverage",
|
||||
@@ -23,7 +22,10 @@ dependencies = [
|
||||
"pytest",
|
||||
"pytest-retry",
|
||||
"cppcheck",
|
||||
"cpplint",
|
||||
"codespell",
|
||||
"ty",
|
||||
"lefthook",
|
||||
]
|
||||
|
||||
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
|
||||
|
||||
2
setup.sh
2
setup.sh
@@ -8,8 +8,10 @@ PLATFORM=$(uname -s)
|
||||
|
||||
echo "installing dependencies"
|
||||
if [[ $PLATFORM == "Darwin" ]]; then
|
||||
if ! command -v python3 &>/dev/null || ! pkg-config --exists libzmq 2>/dev/null; then
|
||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
brew install python3 zeromq
|
||||
fi
|
||||
elif [[ $PLATFORM == "Linux" ]]; then
|
||||
# for AGNOS since we clear the apt lists
|
||||
if [[ ! -d /"var/lib/apt/" ]]; then
|
||||
|
||||
16
test.sh
16
test.sh
@@ -1,20 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
cd $DIR
|
||||
|
||||
# *** env setup ***
|
||||
source ./setup.sh
|
||||
|
||||
# *** build ***
|
||||
scons -j8
|
||||
|
||||
# *** lint ***
|
||||
ty check .
|
||||
#ruff check .
|
||||
pre-commit run --all-files
|
||||
# *** lint + test ***
|
||||
lefthook run test
|
||||
|
||||
# *** test ***
|
||||
msgq/test_runner
|
||||
pytest
|
||||
# *** all done ***
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
printf "\n${GREEN}All good!${NC} Finished build, lint, and test in ${SECONDS}s\n"
|
||||
|
||||
Reference in New Issue
Block a user