From e8a006f747f9fbf4821a9e14033d21aa8c5e53b7 Mon Sep 17 00:00:00 2001 From: Atsushi Sakai Date: Sun, 3 May 2020 23:02:59 +0900 Subject: [PATCH] Add code style checker CI (#321) Add code style checker CI --- .github/workflows/pythonpackage.yml | 12 +++++------- environment.yml | 2 +- rundiffstylecheck.sh | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 rundiffstylecheck.sh diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 574c7be9..defc1596 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -21,17 +21,12 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - - name: Lint with flake8 - run: | - pip install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: install coverage run: pip install coverage - name: install mypy run: pip install mypy + - name: install pycodestyle + run: pip install pycodestyle - name: mypy check run: | find AerialNavigation -name "*.py" | xargs mypy @@ -43,7 +38,10 @@ jobs: find PathPlanning -name "*.py" | xargs mypy find PathTracking -name "*.py" | xargs mypy find SLAM -name "*.py" | xargs mypy + - name: do diff style check + run: bash rundiffstylecheck.sh - name: do all unit tests run: bash runtests.sh + diff --git a/environment.yml b/environment.yml index 6866ed93..da1c3c0a 100644 --- a/environment.yml +++ b/environment.yml @@ -4,7 +4,7 @@ dependencies: - pip - matplotlib - scipy -- numpy==1.15 +- numpy - pandas - coverage - pip: diff --git a/rundiffstylecheck.sh b/rundiffstylecheck.sh new file mode 100644 index 00000000..627e4a1b --- /dev/null +++ b/rundiffstylecheck.sh @@ -0,0 +1,15 @@ +#!/bin/bash +echo "$(basename $0) start!" +VERSION=v0.1.3 +wget https://github.com/AtsushiSakai/DiffSentinel/archive/${VERSION}.zip +unzip ${VERSION}.zip +./DiffSentinel*/starter.sh HEAD origin/master +check_result=$? +rm -rf ${VERSION}.zip DiffSentinel* +if [[ ${check_result} -ne 0 ]]; +then + echo "Error: Your changes contain pycodestyle errors." + exit 1 +fi +echo "$(basename $0) done!" +exit 0