Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console][Yaml] Linter: add Github annotations format for errors#38982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
stof left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should probably have tests for the annotation reporter
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
chalasr commentedNov 20, 2020
Thank you@ogizanagi. |
chalasr commentedNov 20, 2020
@ogizanagi Can you take care of creating the doc issue for this? I accidentally skipped it during the merge |
ogizanagi commentedNov 20, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Github actionscan write errors and warning directly in their output, which result into annotations into the Github checks. It can even provide a filename, line & col number, allowing to display the annnotations inside the PR diff directly, at the right place.
More advanced usage of annotations can be made using theAPI, but regarding the linters provided in Symfony components, it seems the shortcut using output is a great way to enhance the integration with Github Actions.
This PR starts by proposing these changes in the yaml linter:
githubformat, which is the same as thetxtone, except for errors and warning, for which we'll adapt the output to the Github annotations format.txtformat as default, and autodetect if the script is running in a Github action context, then usegithubformat. If it's not, we fallback totxtas before.Once we agree on the details, we could perform the same for other linters (xliff, twig, ...)
Here is a PR using it:ogizanagi/symfony-lint-gha-demo#2
and some screenshots:
(tests to add)This was inspired byPHPStan which is already auto-adapting the output according to the CI, usinghttps://github.com/OndraM/ci-detector