Skip to content

Commit

Permalink
Python PR checks (#44)
Browse files Browse the repository at this point in the history
* Added py-checks.yml workflow for PR python syntax checking

* Added .ruff.toml for PR python error/warning classes to check

* py-checks.yml: checks only run on python files changed
  • Loading branch information
CodeGat authored Sep 29, 2023
1 parent d5921ef commit f9f5591
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/py-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python Checks
on:
pull_request:
paths:
- '**.py'
push:
branches:
- main
paths:
- '**.py'
jobs:
ruff-check:
name: Check syntax
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get py files changed
id: get-files
# In this step, we get the names of all the *.py files changed before the push/pull_request event
# and replaces the newlines with spaces so github actions understands the input in the next step
run: echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -- '*.py' | tr '\n' ' ')" >> $GITHUB_OUTPUT
- uses: chartboost/ruff-action@v1
with:
src: "${{ steps.get-files.outputs.files }}"
args: "check --format github --preview --config .ruff.toml"
5 changes: 5 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
select = ["E","F"]
ignore = ["E221","E241","E272","E731","F405","F821"]
line-length = 80

# "E129", "F999" aren't supported

0 comments on commit f9f5591

Please sign in to comment.