mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14:52 +00:00

Some checks are pending
CI / mkdocs (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks instrumented (ruff) (push) Blocked by required conditions
CI / benchmarks instrumented (ty) (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
37 lines
1.1 KiB
Bash
Executable file
37 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
echo "Enabling mypy primer specific configuration overloads (see .github/mypy-primer-ty.toml)"
|
|
mkdir -p ~/.config/ty
|
|
cp .github/mypy-primer-ty.toml ~/.config/ty/ty.toml
|
|
|
|
PRIMER_SELECTOR="$(paste -s -d'|' "${PRIMER_SELECTOR}")"
|
|
|
|
echo "new commit"
|
|
git rev-list --format=%s --max-count=1 "${GITHUB_SHA}"
|
|
|
|
MERGE_BASE="$(git merge-base "${GITHUB_SHA}" "origin/${GITHUB_BASE_REF}")"
|
|
git checkout -b base_commit "${MERGE_BASE}"
|
|
echo "base commit"
|
|
git rev-list --format=%s --max-count=1 base_commit
|
|
|
|
cd ..
|
|
|
|
echo "Project selector: ${PRIMER_SELECTOR}"
|
|
# Allow the exit code to be 0 or 1, only fail for actual mypy_primer crashes/bugs
|
|
uvx \
|
|
--from="git+https://github.com/hauntsaninja/mypy_primer@0d20fff78b67f11f4dcbeb3d9b1c645b7198db5e" \
|
|
mypy_primer \
|
|
--repo ruff \
|
|
--type-checker ty \
|
|
--old base_commit \
|
|
--new "${GITHUB_SHA}" \
|
|
--project-selector "/($PRIMER_SELECTOR)\$" \
|
|
--output concise \
|
|
--debug > "${DIFF_FILE}" || [ $? -eq 1 ]
|
|
|
|
# Output diff with ANSI color codes
|
|
cat "${DIFF_FILE}"
|
|
|
|
# Remove ANSI color codes before uploading
|
|
sed -ie 's/\x1b\[[0-9;]*m//g' "${DIFF_FILE}"
|