Files
Barış Keser ea5287c3db Add bc package for score comparison
- Install bc package for floating point comparison in workflow
- Required for checking pylint score threshold
2026-01-17 18:12:35 +03:00

57 lines
1.6 KiB
YAML

name: 🔍 Code Quality Check
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
jobs:
pylint-check:
name: 🐍 Pylint Code Quality Analysis
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests lxml GitPython flask pylint
sudo apt-get update && sudo apt-get install -y bc
- name: 🔍 Run Pylint Analysis
run: |
python -m pylint --output-format=parseable --reports=yes . 2>/dev/null > pylint_report.txt || true
- name: 📤 Upload Pylint Report
uses: actions/upload-artifact@v4
with:
name: pylint-report
path: pylint_report.txt
- name: ✅ Check Pylint Score
run: |
# Extract the score from pylint output
SCORE=$(grep "Your code has been rated at" pylint_report.txt | grep -o "[0-9]\+\.[0-9]\+")
if [ -z "$SCORE" ]; then
echo "❌ Could not find pylint score in report"
exit 1
fi
echo "📊 Pylint Score: $SCORE/10"
# Check if score is 5.0 or below
if (( $(echo "$SCORE <= 5.0" | bc -l) )); then
echo "❌ Pylint score is too low ($SCORE/10). Minimum required: 5.0/10"
exit 1
else
echo "✅ Pylint score is acceptable ($SCORE/10)"
fi