chore: Auto-fix formatting and linting errors with Ruff#19
Conversation
|
Warning Review limit reached
More reviews will be available in 51 minutes and 2 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (80)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request focuses on modernizing type annotations (using | instead of Optional/Union and lowercase collections like list and dict), cleaning up unused imports, formatting code, and simplifying nested context managers. The review feedback highlights a critical issue in tests/llm/test_service.py where a pytest.raises block contains only pass and does not actually trigger the expected ImportError. Additionally, the reviewer recommends specifying an explicit encoding="utf-8" when opening text files to avoid platform-dependent encoding issues, and using the built-in callable() function instead of checking hasattr(..., "__call__") for more idiomatic Python code.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| with patch.dict( | ||
| "sys.modules", {"instructor": None, "litellm": None, "mirascope": None} | ||
| ), pytest.raises( | ||
| ImportError, match="Required dependencies not installed" | ||
| ): | ||
| with pytest.raises( | ||
| ImportError, match="Required dependencies not installed" | ||
| ): | ||
| pass | ||
| pass |
There was a problem hiding this comment.
The pytest.raises block only contains pass, which means no exception will actually be raised during the test execution, causing the test to fail with Failed: DID NOT RAISE <class 'ImportError'>. You should trigger the actual import or function call that is expected to raise the ImportError inside the context manager.
| with patch.dict( | |
| "sys.modules", {"instructor": None, "litellm": None, "mirascope": None} | |
| ), pytest.raises( | |
| ImportError, match="Required dependencies not installed" | |
| ): | |
| with pytest.raises( | |
| ImportError, match="Required dependencies not installed" | |
| ): | |
| pass | |
| pass | |
| with patch.dict( | |
| "sys.modules", {"instructor": None, "litellm": None, "mirascope": None} | |
| ), pytest.raises( | |
| ImportError, match="Required dependencies not installed" | |
| ): | |
| import argus.llm.enhanced_service |
|
|
||
| try: | ||
| with open(self.config_path, "r") as f: | ||
| with open(self.config_path) as f: |
There was a problem hiding this comment.
When opening text files, it is highly recommended to specify an explicit encoding (such as encoding="utf-8") to prevent platform-dependent encoding issues, especially when running on systems with different default locales (like Windows).
| with open(self.config_path) as f: | |
| with open(self.config_path, encoding="utf-8") as f: |
| ) | ||
|
|
||
| with open(self.file_path, "r") as f: | ||
| with open(self.file_path) as f: |
There was a problem hiding this comment.
When opening text files, it is highly recommended to specify an explicit encoding (such as encoding="utf-8") to prevent platform-dependent encoding issues, especially when running on systems with different default locales (like Windows).
| with open(self.file_path) as f: | |
| with open(self.file_path, encoding="utf-8") as f: |
| """Load configuration from a file (YAML or JSON).""" | ||
| try: | ||
| with open(path, "r") as f: | ||
| with open(path) as f: |
There was a problem hiding this comment.
When opening text files, it is highly recommended to specify an explicit encoding (such as encoding="utf-8") to prevent platform-dependent encoding issues, especially when running on systems with different default locales (like Windows).
| with open(path) as f: | |
| with open(path, encoding="utf-8") as f: |
| try: | ||
| # Try calling as async first | ||
| if hasattr(capability_method, '__call__'): | ||
| if hasattr(capability_method, "__call__"): |
chore: Auto-fix formatting and linting errors with Ruff
No description provided.