31 add pylance cli check (#32) #77
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: Python Lint | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install linting tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pylint | |
- name: Lint with flake8 | |
run: | | |
flake8 . | |
- name: Lint with pylint | |
run: | | |
pylint $(git ls-files '*.py') || true | |
pylint_score=$(pylint $(git ls-files '*.py') --exit-zero | grep 'Your code has been rated at' | awk '{print $7}' | cut -d'/' -f1) | |
if (( $(echo "$pylint_score >= 7" | bc -l) )); then | |
echo "Pylint score is $pylint_score, which is acceptable." | |
exit 0 | |
else | |
echo "Pylint score is $pylint_score, which is below the acceptable threshold." | |
exit 1 | |
fi |