Skip to content

Conversation

@amotl
Copy link
Member

@amotl amotl commented May 16, 2025

What the title says.

@coderabbitai
Copy link

coderabbitai bot commented May 16, 2025

Walkthrough

This 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

File(s) Change Summary
.github/workflows/tests.yml Added workflow_dispatch and nightly schedule triggers; clarified comments; no job logic changes.
cratedb_mcp/main.py Reformatted decorators, docstrings, and string literals for consistency and clarity; no logic changes.
cratedb_mcp/knowledge.py Removed an extra blank line in DocumentationIndex.__init__; no functional changes.
cratedb_mcp/settings.py Reformatted warning messages to multi-line style; improved comment clarity; logic unchanged.
cratedb_mcp/util/sql.py Stylistic improvements: reformatted instantiations, docstrings, and string literals; no logic changes.
docs/backlog.md Moved "Format code, improve linting" from "Iteration +1" to "Done" section.
pyproject.toml Reduced Ruff line length; uncommented Ruff formatting/check commands.
tests/test_knowledge.py Removed extraneous blank lines in test_queries; test logic unchanged.
tests/test_mcp.py Reformatted test function calls to multi-line style for readability; no logic changes.
tests/test_util.py Reformatted assertions to multi-line style; adjusted unicode escape to lowercase; no logic 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
Loading

Possibly related PRs

  • crate/cratedb-mcp#9: Originally introduced the "Tests" workflow and CI configuration, directly related to the enhancements in this PR.

Suggested reviewers

  • kneth
  • surister

Poem

A hop and a skip, the code is now neat,
With workflows that run while you’re still asleep.
Formatting shines, the warnings align,
And Ruff’s on the job—oh, isn’t that fine?
🐇✨

Code rabbits rejoice, for the backlog is light!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45a9677 and f7c1c13.

📒 Files selected for processing (2)
  • .github/workflows/tests.yml (1 hunks)
  • cratedb_mcp/__main__.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/tests.yml
  • cratedb_mcp/main.py
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between a7cb82e and 45a9677.

📒 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 the fetch_cratedb_docs invocation enhances readability without altering test behavior.


30-32: Consistent multi-line formatting for URL.
Splitting the fetch_cratedb_docs call into multiple lines improves consistency and clarity.


42-44: Purely stylistic reformat of query_sql call.
The refactored indentation and line breaks inside the pytest.raises block preserve existing logic and error handling.

.github/workflows/tests.yml (1)

7-14: Enable manual and scheduled workflow triggers.
Adding workflow_dispatch for manual runs and a nightly schedule at 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 type list[dict].


29-32: Approve multi-line decorator formatting.
Converting the get_cratedb_documentation_index decorator’s description into a multi-line string block improves readability and consistency.


42-44: Docstring and error message consistency.
The added docstring and the formatted ValueError raise in fetch_cratedb_docs are clear, consistent, and align with the surrounding code style.

@amotl amotl marked this pull request as ready for review May 16, 2025 15:16
@amotl amotl merged commit cc2ab1a into main May 16, 2025
6 checks passed
@amotl amotl deleted the format branch May 16, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants