actions / actions/toolkit

JSON problem matchers should support `"loop": true` in patterns other than the last one

Open
#726 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement problem matcher
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the enhancement
According to https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md#single-line-matchers:

loop: whether to loop until a match is not found, only valid on the last pattern of a multipattern matcher

However, I would like to be able to loop in the middle of a pattern, and then, once there are no more matches for that pattern, accumulate a couple more lines.

Code Snippet

In particular, the pattern I want to use is:

{
    "problemMatcher": [
        {
            "owner": "coq-problem-matcher-multiline",
            "pattern": [
                {
                    "regexp": "^File \"([^ \"]+)\", line (\\d+), characters (\\d+-\\d+):",
                    "file": 1,
                    "line": 2,
                    "column": 3
                },
                {
                    "regexp": "^(Warning|Error):\\s*((?:[^\\]]|\\].)*)$",
                    "severity": 1,
                    "message": 2
                },
                {
                    "regexp": "^((?:[^\\]]|\\].)*)$",
                    "severity": 1,
                    "message": 2,
                    "loop": true
                },
                {
                    "regexp": "^(.*?)\\s*\\[(.*)\\]$",
                    "message": 1,
                    "code": 2
                }
            ]
        }
    ]
}

That is, an error message starts with a line File "<FILE>", line <LINE>, characters <COLUMN>:, followed by a line starting with either Warning: or Error:, followed by a potentially multiline message which is recognized as ending with [<CODE>] followed by a newline. (The matcher I wrote isn't perfect, and I end up needing four separate matchers: one for one-line messages, one for two-line messages (unless "loop": true allows zero-or-more rather than one-or-more?), and one for three-or-more-line messages.)

Additional information

Trying this out in https://github.com/mit-plv/fiat-crypto/pull/910

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked problem-matchers documentation and the Coq JSON example first, then locate the toolkit's problem-matcher parsing and matching entry point. Confirm the intended behavior for a loop in a non-final pattern, including whether zero matches are allowed, and define completion with coverage for the stated multiline matcher cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.