feat: add Python linting support with pylint and black
This commit is contained in:
42
.github/workflows/python.yml
vendored
Normal file
42
.github/workflows/python.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Python Lint Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
check-python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install Python linting tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install pylint black
|
||||
|
||||
- name: Run pylint
|
||||
run: |
|
||||
python_files=$(find . -name "*.py" -type f)
|
||||
if [ -z "$python_files" ]; then
|
||||
echo "No Python files found to lint"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pylint $python_files
|
||||
|
||||
- name: Check Black formatting
|
||||
run: |
|
||||
python_files=$(find . -name "*.py" -type f)
|
||||
if [ -z "$python_files" ]; then
|
||||
echo "No Python files found to lint"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
black --check $python_files
|
Reference in New Issue
Block a user