run pre commit in ci (#268)

This commit is contained in:
Willem Melching 2020-05-28 18:53:42 -07:00 committed by GitHub
parent 2ade6eeba8
commit 0430bfa5c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 0 deletions

View File

@ -12,6 +12,9 @@ jobs:
set -e
docker build -t opendbc .
name: "Build"
- name: Static analysis
run: |
docker run opendbc bash -c "cd opendbc && git init && git add -A && pre-commit run --all"
- run: |
docker run opendbc bash -c "python -m unittest discover opendbc"
name: "Unit tests"

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.mypy_cache/
*.pyc
*.os
*.tmp

27
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: master
hooks:
- id: check-ast
- id: check-json
- id: check-xml
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-mypy
rev: master
hooks:
- id: mypy
- repo: https://github.com/PyCQA/flake8
rev: master
hooks:
- id: flake8
args:
- --select=F
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
- --disable=R,C,W

View File

@ -10,6 +10,7 @@ RUN pyenv rehash
COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt
RUN pip install pre-commit==2.4.0 pylint==2.5.2
ENV PYTHONPATH=/project
@ -20,4 +21,5 @@ RUN git clone https://github.com/commaai/cereal.git /project/cereal
COPY SConstruct .
COPY . /project/opendbc
RUN rm -rf /project/opendbc/.git
RUN scons -c && scons -j$(nproc)