Skip to content

Modernize linting and configuration setup #4

Modernize linting and configuration setup

Modernize linting and configuration setup #4

Workflow file for this run

---
name: Lint with Ruff
defaults:
run:
shell: bash
on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]
paths:
- "**/*.py"
- "**/*.yml"
- "**/*.yaml"
- "pyproject.toml"
- ".github/workflows/ruff.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Ruff linter
uses: astral-sh/ruff-action@v1
with:
version: ">=0.12.0"
args: "check"
src: "slither/ tests/ scripts/"
# Formatting check disabled to avoid changes to existing code
# - name: Run Ruff formatter check
# run: |
# echo "::group::Checking formatting with Ruff"
# ruff format --check slither/ tests/ scripts/ || FORMAT_EXIT=$?
# echo "::endgroup::"
# if [ "${FORMAT_EXIT:-0}" -ne 0 ]; then
# echo "❌ Formatting check failed. Run 'make reformat' or 'ruff format' locally to fix formatting."
# exit $FORMAT_EXIT
# fi
# echo "✅ Formatting check passed"
- name: Set up Python for yamllint
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install and run yamllint
run: |
# Use uv for fast installation
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
uv tool install yamllint
echo "::group::Running yamllint"
uvx yamllint .github/ || YAML_EXIT=$?
echo "::endgroup::"
if [ "${YAML_EXIT:-0}" -ne 0 ]; then
echo "❌ YAML linting failed. Fix the YAML syntax errors shown above."
exit $YAML_EXIT
fi
echo "✅ YAML linting passed"