Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
chalasr merged 1 commit intosymfony:5.xfromogizanagi:lint-yaml-gha
Nov 20, 2020
Merged

[Console][Yaml] Linter: add Github annotations format for errors#38982

chalasr merged 1 commit intosymfony:5.xfromogizanagi:lint-yaml-gha
Nov 20, 2020

Conversation

@ogizanagi
Copy link
Contributor

@ogizanagiogizanagi commentedNov 4, 2020
edited
Loading

QA
Branch?5.x
Bug fix?no
New feature?yes
Deprecations?no
TicketsN/A
LicenseMIT
Doc PRTODO

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:

  • add thegithub format, which is the same as thetxt one, except for errors and warning, for which we'll adapt the output to the Github annotations format.
  • remove thetxt format as default, and autodetect if the script is running in a Github action context, then usegithub format. If it's not, we fallback totxt as 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:

PR checks runPR checks annotationsPR diff
Capture d’écran 2020-11-04 à 09 37 07Capture d’écran 2020-11-04 à 09 37 28 Capture d’écran 2020-11-04 à 09 38 28

(tests to add)


This was inspired byPHPStan which is already auto-adapting the output according to the CI, usinghttps://github.com/OndraM/ci-detector

derrabus, lyrixx, j0k3r, chapterjason, fsevestre, DylanDelobel, and mykiwi reacted with thumbs up emojijaviereguiluz, Kocal, chalasr, lyrixx, and dunglas reacted with heart emoji
@ogizanagiogizanagi added this to the5.x milestoneNov 4, 2020
Copy link
Member

@stofstof left a 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

@ogizanagiogizanagi requested a review fromstofNovember 5, 2020 09:08
@chalasrchalasr added Console and removed Console labelsNov 14, 2020
@carsonbotcarsonbot changed the title[Yaml] Linter: add Github annotations format for errors[Console][Yaml] Linter: add Github annotations format for errorsNov 14, 2020
@chalasr
Copy link
Member

Thank you@ogizanagi.

@chalasrchalasr merged commit04eec8b intosymfony:5.xNov 20, 2020
@ogizanagiogizanagi deleted the lint-yaml-gha branchNovember 20, 2020 09:41
@chalasr
Copy link
Member

@ogizanagi Can you take care of creating the doc issue for this? I accidentally skipped it during the merge

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedNov 20, 2020
edited
Loading

@chalasr Sure. Thanks for merging.
I also created an issue for other linters in#39122

chalasr reacted with rocket emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@derrabusderrabusderrabus left review comments

@jderussejderussejderusse approved these changes

@chalasrchalasrchalasr approved these changes

@xabbuhxabbuhAwaiting requested review from xabbuh

@stofstofAwaiting requested review from stof

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

6 participants

@ogizanagi@chalasr@stof@jderusse@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp