mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 13:30:49 -05:00
Now that https://github.com/astral-sh/ruff/pull/20263 is merged, we can update mypy_primer and add the new `egglog-python` project to `good.txt`. The ecosystem-analyzer run shows that we now add 1,356 diagnostics (where we had over 5,000 previously, due to the unsupported project layout).
38 lines
1.1 KiB
Bash
Executable File
38 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@830b80cb00dc8ffee20a7ddcad8d6a13b09c18ed" \
|
|
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}"
|