mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 21:14:01 +08:00
Add cppcheck as a pre-commit hook (#1646)
* add cppcheck as a pre-commit hook * fix Dockerfile * update precommit config * exclude panda and opendbc
This commit is contained in:
14
.github/workflows/test.yaml
vendored
14
.github/workflows/test.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
external/bin selfdrive/modeld/runners $TEST_DIR
|
||||
|
||||
# need these so docker copy won't fail
|
||||
cp Pipfile Pipfile.lock .pylintrc cppcheck_openpilot.sh .coveragerc-app .pre-commit-config.yaml $TEST_DIR
|
||||
cp Pipfile Pipfile.lock .pylintrc .coveragerc-app .pre-commit-config.yaml $TEST_DIR
|
||||
cd $TEST_DIR
|
||||
mkdir laika laika_repo tools release
|
||||
- name: Build Docker image
|
||||
@@ -96,18 +96,6 @@ jobs:
|
||||
run: eval "$BUILD"
|
||||
- name: pre-commit
|
||||
run: $RUN "cd /tmp/openpilot/ && git init && git add -A && pre-commit run --all"
|
||||
- name: cppcheck
|
||||
run: $PERSIST "cd /tmp/openpilot/ && ./cppcheck_openpilot.sh 2> cppcheck_report.txt"
|
||||
- name: Print cppcheck report
|
||||
if: always()
|
||||
run: |
|
||||
docker cp tmppilot:/tmp/openpilot/cppcheck_report.txt cppcheck_report.txt
|
||||
cat cppcheck_report.txt
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: cppcheck_report.txt
|
||||
path: cppcheck_report.txt
|
||||
|
||||
unit_tests:
|
||||
name: unit tests
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -59,7 +59,6 @@ openpilot-apks
|
||||
|
||||
.coverage*
|
||||
coverage.xml
|
||||
cppcheck_report.txt
|
||||
htmlcov
|
||||
pandaextra
|
||||
|
||||
|
||||
@@ -31,3 +31,16 @@ repos:
|
||||
language: system
|
||||
types: [python]
|
||||
exclude: '^(pyextra)|(external)|(cereal)|(rednose)|(panda)|(laika)|(laika_repo)|(rednose_repo)/'
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: cppcheck
|
||||
name: cppcheck
|
||||
entry: cppcheck
|
||||
language: system
|
||||
types: [c++]
|
||||
exclude: '^(phonelibs)|(external)|(cereal)|(opendbc)|(panda)|(tools)|(selfdrive/modeld/thneed/debug)|(selfdrive/modeld/test)|(selfdrive/camerad/test)/'
|
||||
args:
|
||||
- --error-exitcode=1
|
||||
- --quiet
|
||||
- --force
|
||||
- -j8
|
||||
|
||||
@@ -77,7 +77,6 @@ RUN pyenv install 3.8.2 && \
|
||||
RUN mkdir -p /tmp/openpilot
|
||||
|
||||
COPY SConstruct \
|
||||
cppcheck_openpilot.sh \
|
||||
.pylintrc \
|
||||
.pre-commit-config.yaml \
|
||||
.coveragerc-app \
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cppcheck --force -j$(nproc) selfdrive/ common/ opendbc/ cereal/ installer/ 2> cppcheck_report.txt
|
||||
|
||||
@@ -136,7 +136,7 @@ static void ui_draw_sidebar_temp_metric(UIState *s) {
|
||||
}
|
||||
|
||||
static void ui_draw_sidebar_panda_metric(UIState *s) {
|
||||
int panda_severity;
|
||||
int panda_severity = 2;
|
||||
char panda_message_str[32];
|
||||
const int panda_y_offset = 32 + 148;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user