-
Notifications
You must be signed in to change notification settings - Fork 3
Chore: Format code using ruff, and a few manual touches #18
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
Conversation
WalkthroughThis update introduces formatting and stylistic improvements across multiple files, enhances the GitHub Actions workflow to support manual and scheduled runs, and activates previously commented Ruff formatting commands. No functional or logical changes were made to the codebase or exported entities, with all modifications focused on readability, configuration, and workflow flexibility. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
Developer->>GitHub Actions: Push to main / PR opened
GitHub Actions->>GitHub Actions: Run Tests workflow
Developer->>GitHub Actions: Manually trigger workflow (workflow_dispatch)
GitHub Actions->>GitHub Actions: Run Tests workflow
Note over GitHub Actions: At 4:00 AM UTC daily (cron)
GitHub Actions->>GitHub Actions: Run Tests workflow
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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: 0
🧹 Nitpick comments (1)
cratedb_mcp/__main__.py (1)
19-22: Typo in decorator description.
The description string contains minor errors—“allows” should be “allowed” and “un-safe” can be simplified to “unsafe.” Consider updating for clarity.- description="Send an SQL query to CrateDB, only 'SELECT' queries are allows, queries that " - "modify data, columns or are otherwise deemed un-safe are rejected." + description=( + "Send an SQL query to CrateDB. Only 'SELECT' queries are allowed; " + "queries that modify data, columns, or are otherwise deemed unsafe are rejected." + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
.github/workflows/tests.yml(1 hunks)cratedb_mcp/__main__.py(1 hunks)cratedb_mcp/knowledge.py(0 hunks)cratedb_mcp/settings.py(2 hunks)cratedb_mcp/util/sql.py(4 hunks)docs/backlog.md(1 hunks)pyproject.toml(2 hunks)tests/test_knowledge.py(0 hunks)tests/test_mcp.py(2 hunks)tests/test_util.py(3 hunks)
💤 Files with no reviewable changes (2)
- cratedb_mcp/knowledge.py
- tests/test_knowledge.py
🧰 Additional context used
🧬 Code Graph Analysis (3)
tests/test_mcp.py (1)
cratedb_mcp/__main__.py (2)
fetch_cratedb_docs(41-45)query_sql(23-26)
cratedb_mcp/__main__.py (2)
cratedb_mcp/util/sql.py (1)
sql_is_permitted(13-31)cratedb_mcp/knowledge.py (3)
items(136-140)url_permitted(142-157)Queries(11-91)
tests/test_util.py (1)
cratedb_mcp/util/sql.py (1)
sql_is_permitted(13-31)
🔇 Additional comments (21)
pyproject.toml (3)
96-96: Great choice on line length standardization.Reducing the line length from 110 to 100 characters aligns with common Python style guidelines and improves code readability.
194-198: Successfully enabled Ruff formatting tools.Uncommented the Ruff formatting commands that were previously disabled, which aligns perfectly with the PR objective of formatting code using Ruff.
202-202: Added necessary format checking.Enabling the format check as part of linting ensures consistent formatting across the codebase.
cratedb_mcp/settings.py (3)
26-31: Improved readability with multi-line formatting.The warning message is now better formatted for readability with proper line breaks and parameter alignment.
33-40: Well-structured comment and warning formatting.Both the comment and warning are now properly formatted with consistent style and improved readability.
51-59: Consistent formatting style applied.Applied the same consistent formatting style throughout the file with proper multi-line structure for warnings and comments.
cratedb_mcp/util/sql.py (4)
24-26: Improved readability with multi-line function call.Breaking the function call into multiple lines improves readability while maintaining the same functionality.
42-42: Better docstring spacing.Added appropriate blank line in the docstring for better readability.
65-65: Improved docstring phrasing.Rephrased the docstring into a question form, which better matches the property's boolean return value.
84-84: Consistent use of double quotes.Changed from single quotes to double quotes for string literals, maintaining consistent style.
tests/test_util.py (3)
33-36: Improved assertion readability.Breaking the long assertion into multiple lines makes it more readable and easier to maintain.
87-90: Consistent multi-line formatting for long assertions.Continued the pattern of reformatting long assertions to multi-line style for better readability.
125-125: Consistent Unicode escape sequence.Changed the Unicode escape sequence to uppercase format for consistency.
docs/backlog.md (1)
16-16: Move backlog item to Done section.
Updating the backlog to reflect that code formatting and linting improvements are complete aligns with the other changes in this PR.tests/test_mcp.py (3)
23-25: Improve readability by splitting long function call.
The multi-line formatting of thefetch_cratedb_docsinvocation enhances readability without altering test behavior.
30-32: Consistent multi-line formatting for URL.
Splitting thefetch_cratedb_docscall into multiple lines improves consistency and clarity.
42-44: Purely stylistic reformat ofquery_sqlcall.
The refactored indentation and line breaks inside thepytest.raisesblock preserve existing logic and error handling..github/workflows/tests.yml (1)
7-14: Enable manual and scheduled workflow triggers.
Addingworkflow_dispatchfor manual runs and a nightlyscheduleat 4:00 UTC improves CI flexibility and ensures tests run automatically on a daily cadence.cratedb_mcp/__main__.py (3)
16-16: Approve JSON response usage.
Returning.json()from the HTTP POST aligns with the annotated return typelist[dict].
29-32: Approve multi-line decorator formatting.
Converting theget_cratedb_documentation_indexdecorator’s description into a multi-line string block improves readability and consistency.
42-44: Docstring and error message consistency.
The added docstring and the formattedValueErrorraise infetch_cratedb_docsare clear, consistent, and align with the surrounding code style.
What the title says.