Skip to content

Commit

Permalink
Flake 8 updates
Browse files Browse the repository at this point in the history
- Fix all format issues based on flake8
- Add flake8 github action to test all python files
  • Loading branch information
zhx828 committed Jun 14, 2022
1 parent c16b64f commit f4a69fc
Show file tree
Hide file tree
Showing 12 changed files with 624 additions and 458 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,24 @@ on:
branches: [ master, next-minor-release ]

jobs:
build:
lint:
name: Linting using flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Run flake8
uses: julianwachholz/flake8-action@v2
with:
checkName: "Python Lint"
path: .
config: flake8.ini
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pytest:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -27,15 +44,9 @@ jobs:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest
if [[ $PYTHON_VERSION =~ ^2\.[0-9]$ ]]; then pip install -r requirements/common.txt -r requirements/pip2.7.txt; fi
if [[ $PYTHON_VERSION =~ ^3\.[0-9]$ ]]; then pip install -r requirements/common.txt -r requirements/pip3.txt; fi
- name: Lint with flake8
run: |
# 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: Test with pytest
env:
ONCOKB_API_TOKEN: ${{ secrets.ONCOKB_BOT_API_TOKEN }}
Expand All @@ -58,7 +69,7 @@ jobs:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest
if ( $env:PYTHON_VERSION -match '^2\.[0-9]$' )
{
pip install -r requirements/common.txt -r requirements/pip2.7.txt
Expand All @@ -67,12 +78,6 @@ jobs:
{
pip install -r requirements/common.txt -r requirements/pip3.txt
}
- name: Lint with flake8
run: |
# 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: Test with pytest
env:
ONCOKB_API_TOKEN: ${{ secrets.ONCOKB_BOT_API_TOKEN }}
Expand Down
Loading

0 comments on commit f4a69fc

Please sign in to comment.