-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add pyrightconfig.json and fix all pyright errors #448
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "include": ["src/", "tests/"], | ||
| "exclude": [".venv/", "build/", "dist/", ".pytest_cache/", ".hypothesis/"], | ||
| "pythonVersion": "3.14", | ||
| "venvPath": ".", | ||
| "venv": ".venv", | ||
| "typeCheckingMode": "standard", | ||
| "reportUnknownArgumentType": false, | ||
| "reportUnknownMemberType": false, | ||
| "reportUnknownVariableType": false, | ||
| "reportUnknownParameterType": false, | ||
| "reportUnknownLambdaType": false, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: pyrightconfig.json
Line: 12
Comment:
**`reportCallIssue: false` is broad**
`reportCallIssue` covers any error related to calling a non-callable or passing arguments to a call expression — it's not limited to Pydantic-dynamic patterns. Disabling it globally could silently hide real call-site bugs in non-Pydantic code throughout `src/` and `tests/`. The PR description justifies the other `reportUnknown*` suppressions as Pydantic noise, but `reportCallIssue` is harder to attribute purely to Pydantic. Consider using per-file or per-line `# pyright: ignore[reportCallIssue]` ignores at the handful of actual offending sites, or at minimum document here why this global suppression is safe.
How can I resolve this? If you propose a fix, please make it concise. |
||
| "reportCallIssue": false, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider the implications of disabling Disabling If you find real type errors slipping through, consider re-enabling this and using targeted 🤖 Prompt for AI Agents |
||
| "reportPrivateUsage": false, | ||
| "reportMissingTypeStubs": false | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |||||
| from synthorg.core.agent import PersonalityConfig | ||||||
| from synthorg.observability import get_logger | ||||||
| from synthorg.observability.events.template import ( | ||||||
| TEMPLATE_PERSONALITY_PRESET_INVALID, | ||||||
| TEMPLATE_PERSONALITY_PRESET_UNKNOWN, | ||||||
| ) | ||||||
|
|
||||||
|
|
@@ -428,14 +429,22 @@ def get_personality_preset(name: str) -> dict[str, Any]: | |||||
|
|
||||||
|
|
||||||
| # Validate all presets at import time to catch key typos immediately. | ||||||
| for _preset_name, _preset_dict in PERSONALITY_PRESETS.items(): | ||||||
| try: | ||||||
| PersonalityConfig(**_preset_dict) | ||||||
| except (ValidationError, TypeError) as _exc: | ||||||
| msg = f"Invalid personality preset {_preset_name!r}: {_exc}" | ||||||
| raise ValueError(msg) from _exc | ||||||
| if PERSONALITY_PRESETS: | ||||||
| del _preset_name, _preset_dict | ||||||
| def _validate_presets() -> None: | ||||||
| for name, preset in PERSONALITY_PRESETS.items(): | ||||||
| try: | ||||||
| PersonalityConfig(**preset) | ||||||
| except (ValidationError, TypeError) as exc: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify tuple-style multi-except usages that violate the repository rule.
# Expected: this file/line should appear until fixed.
rg -nP --type=py 'except\s*\([^)]*,[^)]*\)\s*(as\s+\w+)?\s*:' src testsRepository: Aureliolo/synthorg Length of output: 11555 Change to PEP 758 except syntax (no parentheses). Line 435 uses Proposed fix- except (ValidationError, TypeError) as exc:
+ except ValidationError, TypeError as exc:📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| logger.warning( | ||||||
| TEMPLATE_PERSONALITY_PRESET_INVALID, | ||||||
| preset_name=name, | ||||||
| error=str(exc), | ||||||
| ) | ||||||
| msg = f"Invalid personality preset {name!r}: {exc}" | ||||||
| raise ValueError(msg) from exc | ||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||
|
|
||||||
|
|
||||||
| _validate_presets() | ||||||
| del _validate_presets | ||||||
|
|
||||||
|
|
||||||
| def generate_auto_name(role: str, *, seed: int | None = None) -> str: | ||||||
|
|
||||||
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.
The
pythonVersionis set to"3.14", which is not a released or planned version of Python. This could lead to unexpected behavior frompyrightas it might not interpret this version correctly. It's recommended to use the actual Python version the project is targeting, for example"3.12"or"3.13", to ensure accurate type checking based on a real language version.