Skip to content

Commit e446cd2

Browse files
committed
chore: add lint script to match linter.yaml from CI
1. The script invokes Python linters from the CI, JSCPD is not invoked. 2. GitHub action is updated to run pyright using local env to match versions and make results reproduciable.
1 parent bbd09f2 commit e446cd2

4 files changed

Lines changed: 83 additions & 9 deletions

File tree

.github/workflows/linter.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ jobs:
4545
- name: Run Pyright (Pylance equivalent)
4646
id: pyright
4747
continue-on-error: true
48-
uses: jakebailey/pyright-action@v2
49-
with:
50-
pylance-version: latest-release
48+
run: uv run pyright src
5149

5250
- name: Run JSCPD for copy-paste detection
5351
id: jscpd

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ dev = [
127127
"trio",
128128
"uvicorn>=0.35.0",
129129
"pytest-timeout>=2.4.0",
130+
"pyright",
130131
"a2a-sdk[all]",
131132
]
132133

scripts/lint.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
# Local replica of .github/workflows/linter.yaml (excluding jscpd copy-paste check)
3+
4+
# ANSI color codes for premium output
5+
RED='\033[0;31m'
6+
GREEN='\033[0;32m'
7+
YELLOW='\033[1;33m'
8+
BLUE='\033[0;34m'
9+
BOLD='\033[1m'
10+
NC='\033[0m' # No Color
11+
12+
FAILED=0
13+
14+
echo -e "${BLUE}${BOLD}=== A2A Python Fixed-and-Lint Suite ===${NC}"
15+
echo -e "Fixing formatting and linting issues, then verifying types...\n"
16+
17+
# 1. Ruff Linter (with fix)
18+
echo -e "${YELLOW}${BOLD}--- [1/4] Running Ruff Linter (fix) ---${NC}"
19+
if uv run ruff check --fix; then
20+
echo -e "${GREEN}✓ Ruff Linter passed (and fixed what it could)${NC}"
21+
else
22+
echo -e "${RED}✗ Ruff Linter failed${NC}"
23+
FAILED=1
24+
fi
25+
26+
# 2. Ruff Formatter
27+
echo -e "\n${YELLOW}${BOLD}--- [2/4] Running Ruff Formatter (apply) ---${NC}"
28+
if uv run ruff format; then
29+
echo -e "${GREEN}✓ Ruff Formatter applied${NC}"
30+
else
31+
echo -e "${RED}✗ Ruff Formatter failed${NC}"
32+
FAILED=1
33+
fi
34+
35+
# 3. MyPy Type Checker
36+
echo -e "\n${YELLOW}${BOLD}--- [3/4] Running MyPy Type Checker ---${NC}"
37+
if uv run mypy src; then
38+
echo -e "${GREEN}✓ MyPy passed${NC}"
39+
else
40+
echo -e "${RED}✗ MyPy failed${NC}"
41+
FAILED=1
42+
fi
43+
44+
# 4. Pyright Type Checker
45+
echo -e "\n${YELLOW}${BOLD}--- [4/4] Running Pyright ---${NC}"
46+
if uv run pyright; then
47+
echo -e "${GREEN}✓ Pyright passed${NC}"
48+
else
49+
echo -e "${RED}✗ Pyright failed${NC}"
50+
FAILED=1
51+
fi
52+
53+
echo -e "\n${BLUE}${BOLD}=========================================${NC}"
54+
if [ $FAILED -eq 0 ]; then
55+
echo -e "${GREEN}${BOLD}SUCCESS: All linting and formatting tasks complete!${NC}"
56+
exit 0
57+
else
58+
echo -e "${RED}${BOLD}FAILURE: One or more steps failed.${NC}"
59+
exit 1
60+
fi

uv.lock

Lines changed: 21 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)