Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
python-version: "3.11"
- name: Install ruff
run: pip install --no-cache-dir ruff
run: pip install --no-cache-dir ruff==0.15.5
- name: Run ruff format check
run: ruff format --check .
- name: Run ruff lint check
Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Lightweight Python formatting/lint for scenario workloads. Matches the ruff job in ci.yml.
# Local: ./scripts/lint (check) or ./scripts/format (auto-fix)
# Optional hooks (skipped when core.hooksPath is set): pip install pre-commit && pre-commit install
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
hooks:
- id: ruff-format
- id: ruff
args: [--fix]
Comment thread
Copilot marked this conversation as resolved.
Outdated
1 change: 1 addition & 0 deletions scenarios/python_safe_point_bias_3.11/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Verifies that the Python profiler correctly attributes CPU time to `slow_method`
def empty_method() -> None:
pass


def slow_method() -> None:
while time() < end_time:
x = "h" + "e" + "l" + "l" + "o" + ","
Expand Down
18 changes: 18 additions & 0 deletions scripts/format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$root"

if ! command -v ruff >/dev/null 2>&1; then
echo "ruff not found; install with: pip install ruff==0.15.5" >&2
exit 1
fi

targets=("$@")
if [ "${#targets[@]}" -eq 0 ]; then
targets=(".")
fi

ruff format "${targets[@]}"
ruff check --fix "${targets[@]}"
Comment thread
Copilot marked this conversation as resolved.
Outdated
19 changes: 19 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail

# Matches the ruff job in .github/workflows/ci.yml (see also scripts/format).
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$root"

if ! command -v ruff >/dev/null 2>&1; then
echo "ruff not found; install with: pip install ruff==0.15.5" >&2
exit 1
fi

targets=("$@")
if [ "${#targets[@]}" -eq 0 ]; then
targets=(".")
fi

ruff format --check "${targets[@]}"
ruff check "${targets[@]}"
Loading