Skip to content

Conversation

@baxen
Copy link
Collaborator

@baxen baxen commented Dec 25, 2025

Summary

Refactors the format_messages function in crates/goose/src/providers/formats/databricks.rs to reduce its line count from 210 lines to 110 lines.

Changes

Extracted two helper functions:

  • format_text_content: Handles text content with image path detection
  • format_tool_response: Handles tool response message conversion

Testing

  • All 17 databricks tests pass
  • Clippy passes with no warnings
  • cargo fmt applied

Task

Fixes TSK-706: Fix too_many_lines: format_messages (210 lines)

Extract helper functions from the 210-line format_messages function:
- format_text_content: handles text content with image path detection
- format_tool_response: handles tool response message conversion

The format_messages function is now 110 lines, well under the 200 line target.
Copilot AI review requested due to automatic review settings December 25, 2025 03:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the format_messages function in databricks.rs to reduce complexity by extracting two helper functions: format_text_content for handling text content with image path detection, and format_tool_response for handling tool response message conversion. The refactoring reduces the line count from 210 to 110 lines while maintaining existing functionality.

Key Changes:

  • Extracted format_text_content helper to handle text content and image path detection
  • Extracted format_tool_response helper to process tool response messages
  • Simplified and reformatted several JSON construction blocks for better readability

@baxen baxen marked this pull request as draft December 25, 2025 03:29
@block block deleted a comment from Copilot AI Dec 25, 2025
@baxen baxen marked this pull request as ready for review December 25, 2025 04:29
Copilot AI review requested due to automatic review settings December 25, 2025 04:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@baxen baxen changed the title TSK-706: Refactor format_messages in databricks.rs to reduce line count chore: refactor format_messages in databricks.rs to reduce line count Dec 25, 2025
@baxen baxen mentioned this pull request Dec 26, 2025
11 tasks
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