-
Notifications
You must be signed in to change notification settings - Fork 429
chore: add lint script to match linter.yaml from CI #809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,6 +127,7 @@ dev = [ | |
| "trio", | ||
| "uvicorn>=0.35.0", | ||
| "pytest-timeout>=2.4.0", | ||
| "pyright", | ||
| "a2a-sdk[all]", | ||
| ] | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #!/bin/bash | ||
| # Local replica of .github/workflows/linter.yaml (excluding jscpd copy-paste check) | ||
|
|
||
| # ANSI color codes for premium output | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[1;33m' | ||
| BLUE='\033[0;34m' | ||
| BOLD='\033[1m' | ||
| NC='\033[0m' # No Color | ||
|
|
||
| FAILED=0 | ||
|
|
||
| echo -e "${BLUE}${BOLD}=== A2A Python Fixed-and-Lint Suite ===${NC}" | ||
| echo -e "Fixing formatting and linting issues, then verifying types...\n" | ||
|
|
||
| # 1. Ruff Linter (with fix) | ||
| echo -e "${YELLOW}${BOLD}--- [1/4] Running Ruff Linter (fix) ---${NC}" | ||
| if uv run ruff check --fix; then | ||
| echo -e "${GREEN}✓ Ruff Linter passed (and fixed what it could)${NC}" | ||
| else | ||
| echo -e "${RED}✗ Ruff Linter failed${NC}" | ||
| FAILED=1 | ||
| fi | ||
|
|
||
| # 2. Ruff Formatter | ||
| echo -e "\n${YELLOW}${BOLD}--- [2/4] Running Ruff Formatter (apply) ---${NC}" | ||
| if uv run ruff format; then | ||
| echo -e "${GREEN}✓ Ruff Formatter applied${NC}" | ||
| else | ||
| echo -e "${RED}✗ Ruff Formatter failed${NC}" | ||
| FAILED=1 | ||
| fi | ||
|
|
||
| # 3. MyPy Type Checker | ||
| echo -e "\n${YELLOW}${BOLD}--- [3/4] Running MyPy Type Checker ---${NC}" | ||
| if uv run mypy src; then | ||
| echo -e "${GREEN}✓ MyPy passed${NC}" | ||
| else | ||
| echo -e "${RED}✗ MyPy failed${NC}" | ||
| FAILED=1 | ||
| fi | ||
|
|
||
| # 4. Pyright Type Checker | ||
| echo -e "\n${YELLOW}${BOLD}--- [4/4] Running Pyright ---${NC}" | ||
| if uv run pyright; then | ||
| echo -e "${GREEN}✓ Pyright passed${NC}" | ||
| else | ||
| echo -e "${RED}✗ Pyright failed${NC}" | ||
| FAILED=1 | ||
| fi | ||
|
|
||
| echo -e "\n${BLUE}${BOLD}=========================================${NC}" | ||
| if [ $FAILED -eq 0 ]; then | ||
| echo -e "${GREEN}${BOLD}SUCCESS: All linting and formatting tasks complete!${NC}" | ||
| exit 0 | ||
| else | ||
| echo -e "${RED}${BOLD}FAILURE: One or more steps failed.${NC}" | ||
| exit 1 | ||
| fi | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is well-structured and achieves its goal. To improve maintainability and reduce code duplication, you could refactor the repeated logic for running each check into a helper function. This would make it easier to add or modify checks in the future.