Improve code review prompts and add prompt testing tools#9
Conversation
1. Update code review prompts to better identify effective code changes 2. Add detailed working hours estimation guidelines 3. Create test_prompt.py for testing individual diff files 4. Create batch_test_prompts.py for batch testing from GitLab 5. Create test_codedog_prompt.py for testing with CodeDog prompts 6. Add test cases with high and low score examples 7. Add documentation for prompt testing tools
|
Caution Review failedThe pull request is closed. WalkthroughThis update introduces a comprehensive framework for evaluating code review prompts using large language models. It adds new command-line tools for testing prompts on single files or in batch mode across multiple GitLab merge requests, with support for custom system prompts and multiple models. The evaluation logic is refactored and expanded to use detailed, structured prompts that require explicit scoring, effective code change classification, and working hours estimation. Output formats are standardized for both JSON and Markdown, and robust error handling and parsing are implemented. Extensive documentation and categorized test diff files are included for prompt benchmarking and comparison. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI_Tool as CLI Tool (test_prompt.py / batch_test_prompts.py)
participant LLM as Language Model API
participant Evaluator as Code Evaluator Logic
participant Output as Output Formatter
User->>CLI_Tool: Provide file/diff or GitLab config, select model/prompt
CLI_Tool->>Evaluator: Prepare prompt, sanitize input
Evaluator->>LLM: Send prompt and code/diff for evaluation
LLM-->>Evaluator: Return structured review (scores, comments, lines, hours)
Evaluator->>Output: Parse and format results (JSON/Markdown)
Output-->>CLI_Tool: Save or print results
CLI_Tool-->>User: Display output or write to file
sequenceDiagram
participant User
participant BatchTool as batch_test_prompts.py
participant GitLab as GitLab API
participant Evaluator as Code Evaluator
participant LLM as Language Model API
participant Output as Output Formatter
User->>BatchTool: Start batch test with GitLab project info
BatchTool->>GitLab: Fetch MR diffs (with filters)
GitLab-->>BatchTool: Return list of MR diffs
loop For each diff file
BatchTool->>Evaluator: Prepare prompt for diff
Evaluator->>LLM: Send prompt and diff
LLM-->>Evaluator: Return review results
Evaluator->>Output: Format and store results
end
BatchTool->>User: Output summary and comparison reports
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (17)
✨ 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:
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 (
|
Summary by CodeRabbit
New Features
Documentation
Test Data
Bug Fixes
Refactor