This is a submission for the Amazon Q Developer "Quack The Code" Challenge: Crushing the Command Line
What I Built
I created GitHub PR Analyzer ๐, a powerful command-line tool that automates code review in GitHub repositories. This tool addresses several pain points that developers face when managing pull requests across multiple repositories:
- Time-consuming manual reviews โณ: Developers often spend hours reviewing PRs, especially in large repositories with many contributors.
- Difficulty tracking PRs across multiple repositories ๐: When working with microservices or distributed systems, tracking PRs across repositories becomes challenging.
- Lack of standardized reporting ๐: Without a consistent way to document PR reviews, valuable insights get lost.
- Missing historical data ๐: Finding patterns in past PRs is difficult without proper archiving.
GitHub PR Analyzer solves these problems by:
- Automating PR analysis ๐ค: Extracts detailed information about PRs (open, closed, or all)
- Detecting code issues ๐: Identifies TODOs, FIXMEs, and files with excessive changes
- Generating comprehensive reports ๐: Creates detailed PDF reports with PR statistics and code analysis
- Supporting multiple repositories ๐: Analyzes several repositories in a single command
- Providing a web interface ๐: Makes all reports accessible through a user-friendly web interface
- Sending email notifications ๐ง: Alerts team members when new reports are generated
The tool is built with Python ๐ and integrates with AWS services (S3, Lambda, SNS, CloudWatch) โ๏ธ. I used Pulumi for infrastructure as code (IaC) ๐ ๏ธโa practice I adopted and refined during my participation in a previous challenge, the Pulumi Challenge, where I first explored infrastructure automation in depth.
Demo
Web Interface ๐
The GitHub PR Analyzer provides a web interface to browse and search all generated reports ๐:
PDF Reports ๐
The tool generates detailed PDF reports with PR statistics and code analysis ๐:
The image above is just a snapshot extracted from the generated PDF. You can view the full report directly in the PDF file available in the repository.
Email Notifications ๐ง
When a new report is generated, team members receive email notifications ๐จ:
Live Demo ๐ฎ
You can access the web interface here: GitHub PR Analyzer Web Interface ๐
Code Repository
The complete code is available on GitHub:
vec21
/
aws-challenge-automation
This repository contains my submission for the Amazon Q Developer Challenge โ Quack the Code (April/May 2025), in the 'Crushing the Command Line' category. Details: https://dev.to/challenges/aws-amazon-q-v2025-04-30
GitHub PR Analyzer ๐
A command-line tool that automates code review in GitHub repositories, generating detailed PDF reports and making them available through a web interface. ๐
Features ๐ฏ
- Pull Request Analysis ๐: Extracts detailed information about PRs (open, closed, or all)
- Code Analysis ๐: Detects issues like TODOs, FIXMEs, and files with many changes
- Date Filtering ๐๏ธ: Allows analyzing PRs created in the last N days
- Multiple Repository Support ๐ฆ: Analyzes multiple repositories in a single report
- PDF Reports ๐: Generates detailed reports in PDF format
- Web Interface ๐: View all reports in a user-friendly web interface
- Email Notifications ๐ง: Receive alerts when new reports are generated
Prerequisites โ
- Python 3.9+ ๐
- AWS account with access to create resources (S3, Lambda, SNS) โ๏ธ
- GitHub personal access token ๐
- Pulumi CLI installed โ๏ธ
Installation ๐ ๏ธ
-
Clone the repository:
git clone https://github.com/vec21/aws-challenge-automation.git cd aws-challenge-automation
-
Create and activate a virtual environment:
python
โฆ
How I Used Amazon Q Developer
Amazon Q Developer ๐ค
Amazon Q Developer was the secret weapon that helped me build this tool efficiently. I leveraged its specialized commands to accelerate development:
/dev
- Code Development ๐ป
Amazon Q Developer helped me bootstrap the project by generating the initial CLI structure with GitHub API integration. This saved me hours of boilerplate coding and documentation reading โณ.
# Generated by Amazon Q Developer
@click.command()
@click.option('--repo', required=True, help='GitHub repository (user/repo) or comma-separated list')
@click.option('--state', default='open', type=click.Choice(['open', 'closed', 'all']),
help='State of PRs to analyze')
def review_code(repo, state):
"""Reviews pull requests from a GitHub repository and generates a PDF report.""" ๐
# Implementation follows...
Amazon Q also helped me implement the Pulumi infrastructure code, setting up S3, Lambda, and SNS services with proper permissions ๐ ๏ธ:
# Generated by Amazon Q Developer
bucket = aws.s3.BucketV2(
"automation-bucket",
bucket="vec21-aws-challenge",
tags={"Name": "AutomationBucket"}
)
website_config = aws.s3.BucketWebsiteConfigurationV2(
"website-config",
bucket=bucket.id,
index_document={"suffix": "index.html"},
error_document={"key": "error.html"}
)
/review
- Code Optimization ๐
When I encountered rate limiting issues with the GitHub API, Amazon Q suggested implementing retry mechanisms ๐:
# Before Amazon Q review
repository = g.get_repo(repo_name)
pulls = repository.get_pulls(state=state)
# After Amazon Q review
try:
repository = g.get_repo(repo_name)
pulls = repository.get_pulls(state=state)
except RateLimitExceededException:
time.sleep(2) # Wait before retrying
repository = g.get_repo(repo_name)
pulls = repository.get_pulls(state=state)
It also identified a critical timezone issue when comparing dates โฐ:
# Before Amazon Q review
since_date = datetime.now() - timedelta(days=days)
# After Amazon Q review
since_date = datetime.now(timezone.utc) - timedelta(days=days)
/test
- Test Generation ๐งช
Amazon Q generated comprehensive test cases for my code, including fixtures and mocks โ
:
# Generated by Amazon Q Developer
@pytest.fixture
def mock_pull_request():
mock = MagicMock()
mock.number = 1
mock.title = "Test PR"
mock.user.login = "testuser"
mock.created_at = datetime.now(timezone.utc)
# More properties...
return mock
def test_analyze_pull_request(mock_repository, mock_pull_request):
result = analyze_pull_request(mock_repository, mock_pull_request)
assert 'complexity' in result
assert 'issues' in result
assert 'languages' in result
/doc
- Documentation ๐
Amazon Q helped me create clear documentation, including the architecture diagram and usage examples ๐:
Architecture ๐๏ธ
The architecture diagram was originally generated by Amazon Q in ASCII format, using characters such as
-
,>
,|
, and letters to illustrate the system components and their interactions. This ASCII diagram was then converted into a visual image using ChatGPT, based on the same structure, to improve readability and presentation ๐จ.
The project uses the following AWS services:
- S3 โ๏ธ: Storage for PDF reports and web interface hosting
- Lambda โก: Scheduled execution of code analysis
- SNS ๐ฌ: Email notification delivery
- CloudWatch Events โฐ: Scheduling of periodic executions
Key Insights from Using Amazon Q Developer ๐ง
- Start with a clear problem statement ๐ฏ: The more specific your request to Amazon Q, the better the generated code.
- Iterative development ๐: Use Amazon Q to generate a basic structure, then refine it with more specific requests.
-
Leverage specialized commands ๐ ๏ธ: The
/dev
,/review
,/test
, and/doc
commands are tailored for different development phases. - Verify and understand the code โ : Always review and understand the generated code before implementing it.
- Use Amazon Q for learning ๐: The explanations provided alongside the code are excellent learning resources.
Future Improvements ๐
While GitHub PR Analyzer already provides significant value in its current form, I have several exciting enhancements planned for future iterations:
Short-term Improvements ๐
-
AI-powered Code Analysis ๐ง : Integrate with Amazon Bedrock or Amazon CodeGuru to provide deeper code insights, including:
- Potential bugs and security vulnerabilities
- Code quality metrics and suggestions
- Performance optimization recommendations
Custom Report Templates ๐: Allow users to define their own report templates to focus on metrics that matter most to their teams.
GitHub Actions Integration โ๏ธ: Create a GitHub Action that automatically generates reports on PR creation, updates, or merges.
Slack/Teams Notifications ๐ฌ: Expand notification options beyond email to include popular team communication platforms.
Medium-term Vision ๐ญ
-
PR Trend Analysis ๐: Implement historical data analysis to identify patterns and trends in your development process:
- PR velocity over time
- Common issues by repository or contributor
- Code quality trends
Interactive Dashboards ๐ฑ: Enhance the web interface with interactive charts and filtering capabilities for better data exploration.
Multi-platform Support ๐: Extend beyond GitHub to support GitLab, Bitbucket, and other Git hosting services.
CI/CD Pipeline Analysis ๐: Correlate PR data with CI/CD pipeline metrics to identify bottlenecks in your development workflow.
Long-term Roadmap ๐บ๏ธ
-
Collaborative Review Features ๐ฅ: Enable teams to collaborate on PR reviews directly within the tool:
- Comment and discussion threads
- Review assignments and tracking
- Approval workflows
-
Machine Learning Insights ๐ค: Train models on your PR history to:
- Predict PR review time and complexity
- Recommend optimal reviewers based on code expertise
- Identify potential merge conflicts before they occur
-
Enterprise Integration ๐ข: Develop enterprise features like:
- SSO authentication
- Role-based access control
- Compliance reporting
- Custom retention policies
Developer Productivity Metrics โก: Provide insights into developer productivity while respecting privacy and focusing on team-level metrics rather than individual performance.
I'm excited to continue evolving this tool based on user feedback and emerging needs in the development community. If you have suggestions for additional features, please share them in the comments or open an issue in the GitHub repository! ๐
Conclusion ๐
Building GitHub PR Analyzer with Amazon Q Developer was a game-changer ๐. What would have taken weeks to develop was completed in days โฉ, with better code quality and more comprehensive documentation ๐. The tool now helps our team save hours each week on code reviews โฐ while providing valuable insights into our development process ๐.
Amazon Q Developer isn't just a code generatorโit's a true development partner ๐ค that helps you think through problems ๐ง , implement solutions ๐ ๏ธ, and learn best practices along the way ๐.
Top comments (0)