Skip to content

ENH: Add QuantEcon Style Guide Checker GitHub Action#227

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-226
Closed

ENH: Add QuantEcon Style Guide Checker GitHub Action#227
Copilot wants to merge 3 commits intomainfrom
copilot/fix-226

Conversation

Copy link
Contributor

Copilot AI commented Aug 25, 2025

This PR implements a comprehensive GitHub Action for automated QuantEcon Style Guide compliance checking, addressing the need for consistent documentation quality across all QuantEcon repositories.

Overview

The new qe-style-check action provides intelligent, AI-enabled style checking with two operation modes:

  1. PR Mode: Triggered by @qe-style-check mention in PR comments
  2. Scheduled Mode: Weekly comprehensive reviews with optional individual PRs per lecture

Key Features

Intelligent Analysis

  • 29 style rules covering writing conventions, code style, mathematical notation, and figure guidelines
  • 3 confidence levels: High (auto-commit), Medium (review recommended), Low (human evaluation needed)
  • Rule-based checking with numbered references (R001-R029) for easy tracking

Flexible Configuration

- uses: QuantEcon/meta/.github/actions/qe-style-check@main
  with:
    style-guide: '.github/copilot-qe-style-guide.md'  # Path or URL
    lectures: 'lectures'                               # Target directory
    exclude-files: 'index.md,references.md'          # Regex patterns
    confidence-threshold: 'high'                      # Auto-commit level
    create-individual-prs: 'true'                     # Scheduled mode option

Comprehensive Reporting

  • Summary statistics with file and suggestion counts
  • Detailed tables organized by confidence level
  • Before/after examples for high confidence suggestions
  • Rule references with line numbers for easy navigation

Style Rules Implemented

Writing Conventions (R001-R005)

  • One-sentence paragraphs
  • Proper heading capitalization
  • Clear, concise language

Code Style (R006-R015)

  • Unicode Greek letters (α instead of alpha)
  • Modern timing patterns (qe.Timer() context manager)
  • PEP8 compliance checking

Mathematical Notation (R016-R021)

  • Proper transpose notation (\top instead of ^T)
  • Built-in equation numbering
  • Standard matrix/vector conventions

Figure Guidelines (R022-R029)

  • No embedded matplotlib titles
  • Proper line width settings (lw=2)
  • Lowercase axis labels

Usage Examples

PR Style Check:
Comment @qe-style-check on any pull request to trigger style analysis of changed files.

Scheduled Review:

name: Weekly Style Check
on:
  schedule:
    - cron: '0 9 * * 1'  # Monday 9 AM UTC
jobs:
  style-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: QuantEcon/meta/.github/actions/qe-style-check@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          mode: 'scheduled'
          create-individual-prs: 'true'

Testing

Comprehensive test suite includes:

  • Local functionality tests (test/qe-style-check/test-basic.sh)
  • Sample files with known style issues and clean examples
  • GitHub Actions workflow tests for all modes
  • File exclusion and confidence level validation

The action successfully detects style violations and provides actionable suggestions while maintaining compatibility with existing QuantEcon repository structures.

Fixes #226.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 25, 2025 06:50
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com>
Copilot AI changed the title [WIP] ENH: Github action for checking QuantEcon Style Guide. ENH: Add QuantEcon Style Guide Checker GitHub Action Aug 25, 2025
Copilot AI requested a review from mmcky August 25, 2025 06:54
@mmcky
Copy link
Contributor

mmcky commented Aug 26, 2025

Will take a different approach to this action due to limitations in making suggestions in PRs (in the github interface).

@mmcky mmcky closed this Aug 26, 2025
@mmcky mmcky deleted the copilot/fix-226 branch August 26, 2025 03:03
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.

ENH: Github action for checking QuantEcon Style Guide.

2 participants