-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: init gritql python #337
Conversation
Warning Rate Limit Exceeded@morgante has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 40 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, 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. WalkthroughThe recent changes encompass renaming functions for clarity, updating import statements, restructuring resolver interfaces, and introducing new test functions and files. Additionally, a new Python library for GritQL has been added, complete with installation and runtime scripts, enhancing the functionality and usability of the Grit CLI tool. These updates aim to improve code readability, consistency, and extend the tool's capabilities for pattern application and testing. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 2
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.
Actionable comments posted: 3
import tarfile | ||
import platform | ||
|
||
from typing import TYPE_CHECKING, List |
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.
Remove unused imports to clean up the code.
- from typing import TYPE_CHECKING, List
+ from typing import TYPE_CHECKING
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
from typing import TYPE_CHECKING, List | |
from typing import TYPE_CHECKING |
|
||
def find_install() -> Path: | ||
"""Installs the Grit CLI and returns the location of the binary""" | ||
if sys.platform == "win32": |
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.
Consider using a more specific exception type for better error handling.
- raise Exception("Windows is not supported yet in the migration CLI")
+ raise NotImplementedError("Windows is not supported yet in the migration CLI")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if sys.platform == "win32": | |
if sys.platform == "win32": | |
raise NotImplementedError("Windows is not supported yet in the migration CLI") |
for error in errors: | ||
sys.stdout.write(f"{error}\n") | ||
|
||
raise CLIError("Could not locate Grit CLI binary - see above errors") |
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.
Define CLIError
to resolve the undefined name error.
+ class CLIError(Exception):
+ """Custom exception for CLI-related errors."""
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
raise CLIError("Could not locate Grit CLI binary - see above errors") | |
class CLIError(Exception): | |
"""Custom exception for CLI-related errors.""" | |
# ... other code ... | |
raise CLIError("Could not locate Grit CLI binary - see above errors") |
def install() -> Path: | ||
"""Installs the Grit CLI and returns the location of the binary""" | ||
if sys.platform == "win32": | ||
raise CLIError("Windows is not supported yet in the migration CLI") |
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.
/grit new Don't allow using undefined functions or classes.
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.
I have created a new review rule: Disallow Usage of Undefined Functions or Classes.
Exposes a basic wrapper package for GritQL that handles applying patterns from Python. This is currently done using the grit binary.
Other options explored
Prior art
Summary by CodeRabbit
New Features
Enhancements
grit_dir
toGlobalFormatFlags
for better directory handling.Tests
Documentation
.gitignore
for Python development.Dependencies
requirements.txt
to includetyper
andhttpx
dependencies.