mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
fix(make): make lint-format-changed work under GNU make and keep renames line-scoped
Some checks failed
Cost map pins recheck / rerun-cost-map-guard (push) Has been cancelled
LiteLLM Rust DB / db-queries (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
Cost map pins recheck / rerun-cost-map-guard (push) Has been cancelled
LiteLLM Rust DB / db-queries (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
This commit is contained in:
parent
c714458f6e
commit
c3f3c0a189
2 changed files with 8 additions and 9 deletions
11
Makefile
11
Makefile
|
|
@ -174,14 +174,11 @@ lint-ruff: $(LINT_DEP_INSTALL)
|
|||
# https://github.com/astral-sh/ruff/discussions/4049
|
||||
lint-format-changed: install-dev
|
||||
@base_ref=$$($(RESOLVE_BASE)) && \
|
||||
diff=$$(git diff "$$base_ref" --unified=0 --no-color --no-renames --diff-filter=d -- '*.py') && \
|
||||
diff=$$(git diff "$$base_ref" --unified=0 --no-color --diff-filter=d -- '*.py') && \
|
||||
printf '%s\n' "$$diff" | \
|
||||
perl -ne '\
|
||||
if (/^diff --git a\/(.*) b\//) { $$file = $$1; } \
|
||||
if (/^@@ .* \+(\d+)(?:,(\d+))? @@/) { \
|
||||
$$start = $$1; $$count = $$2 || 1; $$end = $$start + $$count - 1; \
|
||||
print "$$file:$$start:1-$$end:999\n"; \
|
||||
}' | \
|
||||
perl -ne 'if (/^\+\+\+ b\/(.*)/) { $$file = $$1; }' \
|
||||
-e 'if (/^@@ .* \+(\d+)(?:,(\d+))? @@/) { $$start = $$1; $$count = $$2 || 1; $$end = $$start + $$count - 1;' \
|
||||
-e 'print "$$file:$$start:1-$$end:999\n"; }' | \
|
||||
while read range; do \
|
||||
file="$${range%%:*}"; \
|
||||
lines="$${range#*:}"; \
|
||||
|
|
|
|||
|
|
@ -130,13 +130,15 @@ def test_changed_file_targets_skip_paths_gone_from_the_working_tree(
|
|||
base: Final = _git(repo, "rev-parse", "HEAD")
|
||||
(repo / "litellm" / "kept.py").write_text("value = 2\n")
|
||||
(repo / "litellm" / "dropped.py").write_text("value = 3\n")
|
||||
_commit(repo, "add two modules")
|
||||
_git(repo, "rm", "-q", "litellm/dropped.py", "litellm/example.py")
|
||||
_git(repo, "mv", "litellm/renamed_away.py", "litellm/renamed_to.py")
|
||||
(repo / "litellm" / "renamed_to.py").write_text("a = 1\nb = 2\nc = 3\nd = 5\n")
|
||||
_commit(repo, "add two modules and rename one")
|
||||
_git(repo, "rm", "-q", "litellm/dropped.py", "litellm/example.py")
|
||||
checked: Final = _make(repo, target, "-o", "install-dev", f"BASE_REF={base}", "UV_RUN=echo")
|
||||
assert checked.returncode == 0, checked.stderr
|
||||
assert "litellm/kept.py" in checked.stdout
|
||||
assert "litellm/renamed_to.py" in checked.stdout
|
||||
assert "--range 0:" not in checked.stdout
|
||||
gone: Final = ("litellm/dropped.py", "litellm/example.py", "litellm/renamed_away.py")
|
||||
assert [path for path in gone if path in checked.stdout] == []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue