|
1 | 1 | name: Pylint |
2 | | - |
3 | 2 | on: [push, pull_request] |
4 | | - |
5 | 3 | jobs: |
6 | 4 | pylint: |
7 | 5 | runs-on: ubuntu-latest |
8 | 6 | strategy: |
9 | 7 | matrix: |
10 | | - # === FIX 1: Only list Python versions you actually support === |
11 | | - python-version: ["3.10", "3.11", "3.12"] # Added 3.12 as well, as you support it |
12 | | - |
| 8 | + python-version: ["3.10", "3.11", "3.12"] |
13 | 9 | steps: |
14 | 10 | - uses: actions/checkout@v4 |
15 | | - |
16 | 11 | - name: Set up Python ${{ matrix.python-version }} |
17 | 12 | uses: actions/setup-python@v4 |
18 | 13 | with: |
19 | 14 | python-version: ${{ matrix.python-version }} |
20 | | - |
21 | 15 | - name: Install dependencies |
22 | 16 | run: | |
23 | 17 | python -m pip install --upgrade pip |
24 | 18 | # Install your project dependencies |
25 | 19 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
26 | 20 | pip install pylint |
27 | | -
|
28 | 21 | - name: Analysing the code with pylint |
29 | 22 | run: | |
30 | | - # === FIX 2: Make the check meaningful. Fail if the score is below 9/10 === |
31 | | - # This will make the workflow fail if code quality drops. |
32 | | - find . -type f -name "*.py" | xargs pylint --fail-under=9 |
33 | | -
|
34 | | - - name: Generate pylint report (only if analysis fails) |
35 | | - # This step will only run if the previous step failed, so you can see the report |
36 | | - if: failure() |
37 | | - run: | |
| 23 | + # Generate pylint report and always succeed (|| true prevents failure) |
38 | 24 | find . -type f -name "*.py" | xargs pylint --output-format=text --reports=yes > pylint-report.txt || true |
39 | | -
|
40 | | - - name: Upload pylint report (only if analysis fails) |
41 | | - if: failure() |
| 25 | + echo "Pylint analysis completed. Check the report for details." |
| 26 | + - name: Display pylint score |
| 27 | + run: | |
| 28 | + echo "=== PYLINT REPORT SUMMARY ===" |
| 29 | + if [ -f pylint-report.txt ]; then |
| 30 | + # Extract and display the score line |
| 31 | + grep -E "Your code has been rated at" pylint-report.txt || echo "Score line not found" |
| 32 | + echo "Full report available in artifacts" |
| 33 | + else |
| 34 | + echo "No report file generated" |
| 35 | + fi |
| 36 | + - name: Upload pylint report |
42 | 37 | uses: actions/upload-artifact@v4 |
43 | 38 | with: |
44 | 39 | name: pylint-report-${{ matrix.python-version }} |
|
0 commit comments