Skip to content

Commit 406bbca

Browse files
yunlongwenqwencoder
andcommitted
fix: 修复 import 排序 (pre-commit 自动修复)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 9f3e39e commit 406bbca

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

scripts/pre-push.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,32 @@ REPO_ROOT="$(dirname "$SCRIPT_DIR")"
1313
# Change to repo root
1414
cd "$REPO_ROOT"
1515

16-
# Run linter using python -m to ensure it works in virtual environments
16+
# Run linter - DON'T use --fix, fail if there are issues
1717
echo "📋 Running ruff..."
18-
python3 -m ruff check . --fix || {
19-
echo "❌ Ruff check failed. Please fix linting errors."
18+
python3 -m ruff check . || {
19+
echo ""
20+
echo "❌ Ruff check failed!"
21+
echo ""
22+
echo "💡 To fix automatically, run:"
23+
echo " ruff check . --fix"
24+
echo " ruff format ."
25+
echo ""
26+
echo "Then commit the changes and try again."
2027
exit 1
2128
}
2229

23-
# Run formatter
24-
echo "✨ Running ruff format..."
25-
python3 -m ruff format . || {
26-
echo "❌ Ruff format failed. Please fix formatting."
30+
# Run formatter - check mode, don't modify
31+
echo "✨ Running ruff format check..."
32+
python3 -m ruff format --check . || {
33+
echo ""
34+
echo "❌ Ruff format check failed!"
35+
echo ""
36+
echo "💡 To fix automatically, run:"
37+
echo " ruff format ."
38+
echo ""
39+
echo "Then commit the changes and try again."
2740
exit 1
2841
}
2942

3043
echo "✅ All pre-push checks passed!"
31-
echo ""
32-
echo "💡 Tip: Run 'pytest' locally before pushing to catch test failures."
3344
exit 0

scripts/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def main() -> int:
4747
if sys.version_info < (3, 9):
4848
print(f" ❌ Python 3.9+ required, found {sys.version_info.major}.{sys.version_info.minor}")
4949
return 1
50-
print(f" ✅ Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} detected")
50+
print(
51+
f" ✅ Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} detected"
52+
)
5153

5254
# Step 2: Check if installed
5355
print_step(2, "Checking installation...")

0 commit comments

Comments
 (0)