Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/workflows/black.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/black_auto.yml

This file was deleted.

77 changes: 0 additions & 77 deletions .github/workflows/linter.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/matchers/pylint.json

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/matchers/yamllint.json

This file was deleted.

59 changes: 0 additions & 59 deletions .github/workflows/pylint.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
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:
args: "check 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
export PATH="$HOME/.local/bin:$PATH"
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"
Comment on lines +26 to +68

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 25 days ago

To fix the problem, we need to explicitly set the permissions block in the workflow. For this workflow, the only activities are linting the code and yaml files—no steps involve writing results back to the repository, interacting with issues, or creating PRs. Therefore, the minimal permission required is contents: read. The permissions: key can be added either at the workflow root (affecting all jobs) or within a specific job (affecting only that job). Since there is only one job (lint), either is acceptable; best practice is at the workflow root for simplicity. To implement the change, add a block directly below the workflow name: on line 2:

permissions:
  contents: read

No new imports or custom methods are needed for this change.

Suggested changeset 1
.github/workflows/ruff.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml
--- a/.github/workflows/ruff.yml
+++ b/.github/workflows/ruff.yml
@@ -1,5 +1,7 @@
 ---
 name: Lint with Ruff
+permissions:
+  contents: read
 
 defaults:
   run:
EOF
@@ -1,5 +1,7 @@
---
name: Lint with Ruff
permissions:
contents: read

defaults:
run:
Copilot is powered by AI and may make mistakes. Always verify output.
Loading
Loading