Implement AI-powered Style Guide Checker with GitHub Suggestions#219
Implement AI-powered Style Guide Checker with GitHub Suggestions#219
Conversation
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Auto-applied by Style Guide Checker action
Auto-applied by Style Guide Checker action
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
|
@copilot this repository is hosting our This test |
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Fixed! The test was failing because it was looking for |
|
@copilot this is just a question, please don't implement anything yet. When in PR mode, is it possible to create a Alternatively is there a way to add a |
Both approaches are technically feasible! Here's how each could work: Comment-based trigger (easier to implement):
Reviewer-based trigger (more complex):
The comment-based approach would be simpler and more user-friendly - users could just comment |
|
Thanks @copilot let's go with a comment-based trigger. Can you please implement? |
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
I've implemented the comment-based trigger system! Users can now trigger style guide reviews by commenting on PRs with either:
Key features added:
The workflow includes nice UX touches like adding "eyes" reaction when triggered and thumbs up/down based on success/failure. Users get immediate feedback and detailed results posted as comments. See commit 79779b2 for the complete implementation. |
📝 Style Guide Review SummaryFiles reviewed: 7 Changes made:
Suggestion breakdown:
The high-confidence changes have been automatically applied to maintain consistency with the QuantEcon Style Guide. Please review the other suggestions in the file comments. Generated by Style Guide Checker Action |
|
@copilot can we update the PR mode. Is it possible to take the |
…high-confidence changes Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Updated PR mode to use GitHub suggestions instead of auto-commits for high-confidence changes. Now in PR mode:
Full mode still auto-commits high-confidence changes for scheduled reviews. Commit f992262 implements this change. |
|
@copilot I am testing this new action in QuantEcon/lecture-python-advanced.myst#250 and I am getting the following ERROR |
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Fixed the GitHub suggestions issue! The error occurred because the previous implementation tried to create review comments using absolute line numbers, but GitHub's suggestion API requires diff positions for lines that are actually part of the PR changes. The new implementation (commit 843d7d1):
This should resolve the "Unprocessable Entity: 422" error you encountered in the lecture-python-advanced.myst PR. |
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
| import time | ||
| import numpy as np | ||
|
|
||
| def utility_function(c, alpha=0.5, beta=0.95): |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use Unicode α instead of 'alpha' for better mathematical notation
Rule category: variable_naming
| def utility_function(c, alpha=0.5, beta=0.95): | |
| def utility_function(c, α=0.5, beta=0.95): |
| import time | ||
| import numpy as np | ||
|
|
||
| def utility_function(c, alpha=0.5, beta=0.95): |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use Unicode β instead of 'beta' for better mathematical notation
Rule category: variable_naming
| def utility_function(c, alpha=0.5, beta=0.95): | |
| def utility_function(c, alpha=0.5, β=0.95): |
|
|
||
| Bad equation formatting: | ||
|
|
||
| $x_t = alpha * x_{t-1} + epsilon_t$ |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use Unicode α instead of 'alpha' for better mathematical notation
Rule category: variable_naming
| $x_t = alpha * x_{t-1} + epsilon_t$ | |
| $x_t = α * x_{t-1} + epsilon_t$ |
|
|
||
| ```python | ||
| # More bad Greek letter usage | ||
| def another_function(x, sigma=1.0, theta=0.5, rho=0.9): |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use Unicode σ instead of 'sigma' for better mathematical notation
Rule category: variable_naming
| def another_function(x, sigma=1.0, theta=0.5, rho=0.9): | |
| def another_function(x, σ=1.0, theta=0.5, rho=0.9): |
|
|
||
| ```python | ||
| # More bad Greek letter usage | ||
| def another_function(x, sigma=1.0, theta=0.5, rho=0.9): |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use Unicode θ instead of 'theta' for better mathematical notation
Rule category: variable_naming
| def another_function(x, sigma=1.0, theta=0.5, rho=0.9): | |
| def another_function(x, sigma=1.0, θ=0.5, rho=0.9): |
| Should use proper Unicode and equation numbering. | ||
|
|
||
| ```python | ||
| # More bad Greek letter usage |
There was a problem hiding this comment.
Style Guide Suggestion (medium confidence)
Lecture titles should use title case (capitalize all words)
Suggested change:
# More Bad Greek Letter UsageRule category: titles_headings
| return (c**(1-alpha) - 1) / (1-alpha) * beta | ||
|
|
||
| # Bad timing pattern | ||
| start_time = time.time() |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use modern qe.Timer() context manager instead of manual timing
Rule category: performance_timing
| start_time = time.time() | |
| with qe.Timer(): |
| # Bad timing pattern | ||
| start_time = time.time() | ||
| result = utility_function(1.0) | ||
| end_time = time.time() |
There was a problem hiding this comment.
Style Guide Suggestion (high confidence)
Use modern qe.Timer() context manager instead of manual timing
Rule category: performance_timing
| end_time = time.time() | |
| with qe.Timer(): |
| """Utility function with proper Unicode Greek letters.""" | ||
| return (c**(1-α) - 1) / (1-α) * β | ||
|
|
||
| # Proper timing with qe.Timer() |
There was a problem hiding this comment.
Style Guide Suggestion (medium confidence)
Lecture titles should use title case (capitalize all words)
Suggested change:
# Proper Timing With Qe.timer()Rule category: titles_headings
| @@ -0,0 +1,11 @@ | |||
| # Test file for exclusion | |||
There was a problem hiding this comment.
Style Guide Suggestion (medium confidence)
Lecture titles should use title case (capitalize all words)
Suggested change:
# Test File For ExclusionRule category: titles_headings
Style Guide SuggestionsThe following suggestions are for lines not changed in this PR:
|
📝 Style Guide Review SummaryFiles reviewed: 7 Suggestions provided:
Suggestion breakdown:
All suggestions are based on the QuantEcon Style Guide. High-confidence suggestions can be applied with a single click using GitHub's suggestion feature for transparency and reviewer control. Generated by Style Guide Checker Action |
This PR implements a comprehensive GitHub Action that uses AI to review QuantEcon lectures for compliance with the QuantEcon Style Guide. The action provides transparent, reviewer-controlled suggestions through GitHub's native suggestion system.
🎯 Key Features
AI-Powered Analysis with Robust Fallback
Transparent Suggestion System
Flexible Trigger Options
/style-checkor@quantecon-style-guideon any PRSmart File Management
.*archive.*\.md,.*_old\.md)🔧 GitHub Suggestions Integration
The action intelligently determines which suggestions can use GitHub's native suggestion system:
Example high-confidence suggestion on a changed line:
Scheduled Full Review:
The action prioritizes transparency and reviewer control while providing intelligent, AI-powered style suggestions. The GitHub suggestions feature ensures that all changes are visible and require explicit approval, making the review process both efficient and trustworthy.
Fixes #204.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.