Repository navigation
feat: group logs based on file when using gh formatter - #2094
Conversation
|
Where can I find a reference for this format? |
|
@azu this is logging the file context as plain text so u can see it in the gh logs. The content going in annotations is defined in https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-a-warning-message |
|
@azu can u take a look at this please. See open-telemetry/semantic-conventions#3928 as an example of what prompted this usability improvement. Key thing is if the log line starts with :: it triggers handling as an annotation otherwise handles it as an ordinary log line. |
|
Thanks, I understand the motivation. There are similar reports in Ruff #1693 and Oxlint #20492. Ruff considered separate plaintext lines, but ultimately included the location in the annotation message itself(Ruff #1696). For that reason, I would prefer not to add a separate, Essentially, I think this is a problem that GitHub should fix. |
|
It seems like there is no consensus on how best to do it, as some widely popular tools ie cspell duplicate the entire log once in standard log format & once in gh format, some group them based on file ie yamlint, some duplicate info into the body ie mdling. Would it be fine to follow the grouping solution as we already do in the stylish formatter? That seems the nicest option as it even improves usability as the messages can be collapsed per file. |
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
| output += ` @ L${message.loc.start.line || 1}`; | ||
| output += `C${message.loc.start.column || 1}`; |
There was a problem hiding this comment.
I think <filepath>:<line number>:<column> is better.
For example, browser stack traces and web technologies like VSCode often use this format.
<filepath>:<line number>:<column>: <message>
or
<message> @ <filepath>:<line number>:<column>
Since the location information is displayed in a different location when there are multiple lines, I think the following format, similar to Ruff, would be better.
<filepath>:<line number>:<column>: <message>
There was a problem hiding this comment.
Filepath is un-necessary as it is the name of the group and this follows the structure of the stylish formatter. These groups provide indentation and even enable collapsible groups of logs hence improves usability.
The location ie L{{x}}C{{x}} is the github format used see https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet and also what u get when you share a code reference.
There was a problem hiding this comment.
Also note in pretty view, the user will have a list of files with issues and clicking one shows the issues in that file directly under the heading they clicked. Hence this is a great bonus for a user.
There was a problem hiding this comment.
The location ie L{{x}}C{{x}} is the github format used see https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet and also what u get when you share a code reference.
Hmm, I think it would be fine if it were an actual URL like <url>#L{{x}}C{{x}}.
However, I thought this would just display the string L{{x}}C{{x}}, but am I wrong?
I don't see much value in it because I feel like users would need to understand the meaning of 'L' and 'C'.
Also note in pretty view, the user will have a list of files with issues and clicking one shows the issues in that file directly under the heading they clicked. Hence this is a great bonus for a user.
Do you have a screenshot?
There was a problem hiding this comment.
It would be just like yamllint, see an interactive example at https://github.com/open-telemetry/semantic-conventions/actions/runs/29971521674/job/89094348620?pr=3919
With the logs being
2026-07-23T01:20:10.7416825Z ##[group]./.chloggen/3919.yaml
2026-07-23T01:20:10.7419399Z ##[error]5:1 [empty-lines] too many blank lines (1 > 0)
2026-07-23T01:20:10.7420484Z ##[endgroup]
There was a problem hiding this comment.
thank you,
The format of yamllint looks good.
How about using the same format?
What I find questionable is the use of the unusual format L<line>C<column> as a string to display.
##[group]<path>
##[error]<line>:<column> [<ruleid>] <message>
##[endgroup]
There was a problem hiding this comment.
I have just added the semicolon between line and column so it is now L<line>:C<column> that way reader has context what it relates to. If you just had 9:40, you could mistake it for a time.
Is that ok, other option would be Location = <line>:<column> but i suspect that is too verbose
There was a problem hiding this comment.
It's not that clear when you are skim reading things as you are in rush or you have been going at it for a very long time. Anyway i have made the change as even with the ambiguity is still an improvement to what we have now.
|
@azu just following up now that i shared additional reasoning why the filename is un-necessary in the body. |
<!-- Release notes generated using configuration in .github/release.yml at master --> ## What's Changed ### Feature * Upgrade textlint MCP server to SDK v2 by @azu in #2102 * feat: group logs based on file when using gh formatter by @thompson-tomo in #2094 ### Documentation * docs: update package URL by @314systems in #2061 ### Refactoring * refactor: replace chalk with Node.js built-in styleText() by @Bhavysinghal in #2079 * refactor(ast-node-types): simplify TypeofTxtNode with a lookup map by @314systems in #2078 ### CI * CI: Upgrade automerge-gate action to v5.0.0 by @azu in #2048 * chore(deps): update peaceiris/actions-gh-pages action to v4.1.0 by @renovate[bot] in #2049 * chore(deps): update github/codeql-action action to v3.35.5 by @renovate[bot] in #2053 * chore(deps): update github/codeql-action action to v3.36.0 by @renovate[bot] in #2058 * chore(deps): update patch updates to v3.36.1 by @renovate[bot] in #2069 * chore(deps): update patch updates to v3.36.2 by @renovate[bot] in #2070 * chore(deps): update github/codeql-action action to v3.36.3 by @renovate[bot] in #2086 * chore(deps): update github/codeql-action action to v3.37.0 by @renovate[bot] in #2090 * chore(deps): update github/codeql-action action to v3.37.1 by @renovate[bot] in #2093 * chore(deps): update minor updates by @renovate[bot] in #2097 * chore(deps): update github/codeql-action action to v3.37.2 by @renovate[bot] in #2098 * chore(deps): update github/codeql-action action to v3.37.3 by @renovate[bot] in #2099 ### Dependency Updates * chore(deps): update dependency oxlint-tsgolint to ^0.23.0 by @renovate[bot] in #2051 * chore(deps): update dependency @types/react to ^18.3.29 by @renovate[bot] in #2054 * chore(deps): update dependency mocha to ^11.7.6 by @renovate[bot] in #2055 * chore(deps): update babel monorepo to ^7.29.7 by @renovate[bot] in #2056 * chore(deps): update babel monorepo to ^7.29.7 by @renovate[bot] in #2057 * chore(deps): update pnpm to v10.34.0 by @renovate[bot] in #2059 * chore(deps): update pnpm to v10.34.1 by @renovate[bot] in #2060 * chore(deps): update minor updates to ^4.2.0 by @renovate[bot] in #2063 * chore(deps): update vitest monorepo to ^3.2.6 by @renovate[bot] in #2064 * chore(deps): update react monorepo (patch) by @renovate[bot] in #2065 * chore(deps): update minor updates to ^24.13.0 by @renovate[bot] in #2066 * chore(deps): update react monorepo to ^18.3.31 by @renovate[bot] in #2067 * chore(deps): update patch updates to ^24.13.1 by @renovate[bot] in #2068 * chore(deps): update patch updates (patch) by @renovate[bot] in #2072 * chore(deps): update patch updates to v10.34.4 by @renovate[bot] in #2074 * chore(deps): update dependency js-yaml to ^4.3.0 by @renovate[bot] in #2080 * chore(deps): update dependency oxlint-tsgolint to ^0.24.0 by @renovate[bot] in #2083 * chore(deps): update dependency vitest to ^3.2.7 by @renovate[bot] in #2085 * chore(deps): update dependency @types/node to ^24.13.3 by @renovate[bot] in #2087 * chore(deps): update pnpm to v10.34.5 by @renovate[bot] in #2088 * chore(deps): update docusaurus monorepo to ^3.10.2 by @renovate[bot] in #2089 * chore(deps): update dependency oxlint-tsgolint to ^0.25.0 by @renovate[bot] in #2092 * chore(deps): update react monorepo to ^19.2.8 by @renovate[bot] in #2095 * chore(deps): update dependency @modelcontextprotocol/sdk to ^1.30.0 by @renovate[bot] in #2100 ## New Contributors * @Bhavysinghal made their first contribution in #2079 **Full Changelog**: v15.7.1...v15.8.0 Co-authored-by: azu <azu@users.noreply.github.com>

This groups the logs based on file just like the stylish formatter. This is so that when using the github format you can see what the messages refer to without needing to check annotation.
The current scenario is
