Skip to content

Make the @qe-style-checker comment trigger robust to surrounding prose #26

Description

@mmcky

Summary

The comment-trigger parser currently treats the entire comment body as @qe-style-checker <lecture> <categories>. Any extra prose in the comment breaks the parse, even when the command line itself is well-formed. The trigger should extract only the relevant command and ignore surrounding text.

Reproduction

A user posted this as an issue comment in QuantEcon/test-action-style-guide:

@qe-style-checker lectures/markov_chains_jax.md

But this has to be in a comment.

The run failed: test-action-style-guide run #27174490270

⚠️  Invalid categories: But
❌ Could not extract lecture name from comment
Process completed with exit code 1.

The command line @qe-style-checker lectures/markov_chains_jax.md was valid, but:

  • the trailing word "But" was parsed as a rule category (invalid), and
  • the multi-line prose caused lecture-name extraction to fail.

Expected behavior

A normal human comment that happens to contain the trigger should still work, e.g.:

@qe-style-checker lectures/markov_chains_jax.md — thanks!

or the trigger followed by explanatory text on later lines.

Suggested approach

  • Parse only the line that contains @qe-style-checker, not the whole comment body.
  • On that line, take the first token after the trigger as the lecture path; treat a following token as categories only if it matches the known category set (admonitions, code, figures, jax, links, math, references, writing) — otherwise ignore trailing tokens rather than erroring.
  • Optionally: when categories are omitted, fall back to the default set instead of failing.
  • Improve the error messages to echo the line that was parsed, so misuse is easier to diagnose.

Context

Found while running comment-triggered demos in the test repo. Current behavior forces users to post a bare command with no surrounding text, which is an easy footgun.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions