|
1 | 1 | name: Pylint |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: [push, pull_request] |
4 | 4 |
|
5 | 5 | jobs: |
6 | | - build: |
| 6 | + pylint: |
7 | 7 | runs-on: ubuntu-latest |
8 | 8 | strategy: |
9 | 9 | matrix: |
10 | | - python-version: ["3.8", "3.9", "3.10"] |
| 10 | + python-version: ["3.8", "3.9", "3.10", "3.11"] |
| 11 | + |
11 | 12 | steps: |
12 | 13 | - uses: actions/checkout@v4 |
| 14 | + |
13 | 15 | - name: Set up Python ${{ matrix.python-version }} |
14 | | - uses: actions/setup-python@v3 |
| 16 | + uses: actions/setup-python@v4 |
15 | 17 | with: |
16 | 18 | python-version: ${{ matrix.python-version }} |
| 19 | + |
17 | 20 | - name: Install dependencies |
18 | 21 | run: | |
19 | 22 | python -m pip install --upgrade pip |
| 23 | + # Install your project dependencies if you have a requirements.txt |
| 24 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 25 | + # Install pylint |
20 | 26 | pip install pylint |
| 27 | + |
21 | 28 | - name: Analysing the code with pylint |
22 | 29 | run: | |
23 | | - pylint $(git ls-files '*.py') |
| 30 | + # Find all Python files and run pylint on them |
| 31 | + find . -type f -name "*.py" | xargs pylint --exit-zero |
| 32 | + # Alternative: Use git to find Python files (your original approach) |
| 33 | + # pylint $(git ls-files '*.py') --exit-zero |
| 34 | + |
| 35 | + - name: Generate pylint report |
| 36 | + run: | |
| 37 | + # Generate a detailed report and save to file |
| 38 | + find . -type f -name "*.py" | xargs pylint --output-format=text --reports=yes > pylint-report.txt || true |
| 39 | + |
| 40 | + - name: Upload pylint report |
| 41 | + uses: actions/upload-artifact@v3 |
| 42 | + with: |
| 43 | + name: pylint-report-${{ matrix.python-version }} |
| 44 | + path: pylint-report.txt |
0 commit comments