Skip to content

docs: strikethrough #28

docs: strikethrough

docs: strikethrough #28

Workflow file for this run

name: Linting
on: [push, pull_request]
jobs:
ruff:
name: ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install ruff and requirements
run: |
pip3 install ruff==0.1.0
- name: Run ruff
run: |
set +e # Do not exit shell on ruff failure
nonzero_exit=0
files=$(find . -type f -name "*.py" | sort)
while read file; do
out=$(ruff check "$file" 2> ruff_stderr.txt)
exit_code=$?
err=$(<ruff_stderr.txt)
if [[ $exit_code -ne 0 ]]; then
nonzero_exit=$exit_code
fi
if [[ -n "$out" ]]; then
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
if [[ -n "$err" ]]; then
echo "${err}"
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
out=$(ruff check --diff "$file" 2> ruff_stderr.txt)
err=$(<ruff_stderr.txt)
if [[ -n "$out" ]]; then
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
if [[ -n "$err" ]]; then
echo "${err}"
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
fi
done <<< "$files"
# Exit with the first non-zero exit-code returned by ruff
# or just zero if all passed
exit ${nonzero_exit}