Merge pull request #25 from Tinny-Robot/main #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint Code Check | |
on: | |
push: | |
branches: | |
- main | |
- '**' # Run on pushes to all branches | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: Run pylint | |
id: pylint | |
run: | | |
pylint --rcfile=.pylintrc $(git ls-files '*.py') > pylint_output.txt || true | |
score=$(tail -n 2 pylint_output.txt | head -n 1 | grep -oP '\d+\.\d+') | |
echo "Pylint score: $score" | |
if (( $(echo "$score < 8" | bc -l) )); then | |
echo "Pylint score is less than 8. Failing the job." | |
exit 1 | |
fi |