summaryrefslogtreecommitdiff
path: root/.github/workflows/unused-imports.yml
blob: 83098ddf6a7276f53f7f047ec6d5da3f7e240311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: Check for unused imports using Pylint
on:
  pull_request_target:
    types: [opened, reopened, ready_for_review, locked]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.11"]
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pylint
    - name: Analysing the code with pylint
      run: |
        tmp=$(git ls-files *.py | xargs pylint | grep W0611 | wc -l)
        if [[ $tmp -gt 0 ]]; then
            echo "Found $tmp occurrence of unused Python import statements!"
            exit 1
        fi
        exit 0