Skip to content

Commit a3942ab

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1622 from teojgo/ci/unused_imports
[ci] Add Github action to check for unused imports
2 parents f2ab219 + bc96bf3 commit a3942ab

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,25 @@ jobs:
4646
- name: Run Unittests
4747
run: |
4848
docker run reframe:${{ matrix.modules-version }}
49+
50+
flake8:
51+
if: github.event_name == 'pull_request'
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
fetch-depth: 0
57+
- name: Changed Python Files
58+
run: |
59+
echo 'CHANGED_PYTHON_FILES<<EOF' >> $GITHUB_ENV
60+
git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.sha }} | grep '.py' >> $GITHUB_ENV
61+
echo 'EOF' >> $GITHUB_ENV
62+
- uses: actions/setup-python@v2
63+
with:
64+
python-version: 3.8
65+
- name: Unused Imports Check
66+
run: |
67+
pip install flake8
68+
echo 'Checking Python Files:'
69+
for f in "$CHANGED_PYTHON_FILES"; do echo "$f"; done
70+
flake8 --select F401 $CHANGED_PYTHON_FILES

reframe/frontend/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import reframe
1818
import reframe.core.config as config
19-
import reframe.core.environments as env
2019
import reframe.core.exceptions as errors
2120
import reframe.core.logging as logging
2221
import reframe.core.runtime as runtime

reframe/frontend/loader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
import ast
1111
import collections.abc
1212
import inspect
13-
import io
1413
import os
1514

1615
import reframe.utility as util
1716
import reframe.utility.osext as osext
18-
from reframe.core.exceptions import NameConflictError, RegressionTestLoadError
17+
from reframe.core.exceptions import NameConflictError
1918
from reframe.core.logging import getlogger
2019

2120

0 commit comments

Comments
 (0)