Skip to content

Commit

Permalink
Merge pull request #179 from oncokb/add-flake8
Browse files Browse the repository at this point in the history
Add flake8 github action and fix all flake8 errors
  • Loading branch information
zhx828 authored Jun 15, 2022
2 parents c16b64f + 82016bc commit 8ddbb88
Show file tree
Hide file tree
Showing 13 changed files with 625 additions and 459 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
2 changes: 1 addition & 1 deletion .version-level
Original file line number Diff line number Diff line change
@@ -1 +1 @@
minor
patch
Loading

0 comments on commit 8ddbb88

Please sign in to comment.