Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier the code and check if formatted in the CI #2063

Open
andy840119 opened this issue Jul 10, 2023 · 5 comments
Open

Prettier the code and check if formatted in the CI #2063

andy840119 opened this issue Jul 10, 2023 · 5 comments
Labels
code quality Improve code quality. Good for contributor Those issues does not UX or behavior-related, so did not need lots of discussion.

Comments

@andy840119
Copy link
Member

Yes, it another topic to find things to do

Here's are two way:

  1. use dotnet format
  2. use prettier-plugin-csharp

Not very sure if the first way able to check if the file is formatted only?

@andy840119 andy840119 added the code quality Improve code quality. label Jul 10, 2023
@andy840119
Copy link
Member Author

andy840119 commented Jul 10, 2023

Also, note that will check the code format in the CI.
Not very sure is it possible to check the edited file only?

[Update]
dotnet format can include or exclude the file or folder.
See: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-format

Also github action has only-changed-files config, see: #2065.

@andy840119
Copy link
Member Author

andy840119 commented Jul 15, 2023

Should fix the CI broken.

Here's the comment generated in the github action:

dotnet format --check --dry-run --files osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Notes/NotePropertyChangeHandlerTest.cs,osu.Game.Rulesets.Karaoke.Tests/Editor/Generator/GeneratorConfigHelper.cs,osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/SingerConverterTest.cs,osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/StageInfoConverterTest.cs,osu.Game.Rulesets.Karaoke.Tests/VisualTestRunner.cs,osu.Game.Rulesets.Karaoke/Beatmaps/ElementId.cs,osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricReferenceChangeHandler.cs,osu.Game.Rulesets.Karaoke/Edit/Checks/CheckBeatmapStageInfo.cs,osu.Game.Rulesets.Karaoke/Edit/Generator/PropertyDetector.cs,osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs,osu.Game.Rulesets.Karaoke/Overlays/KaraokeChangelogOverlay.cs,osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricList/Rows/Info/Badge/ReferenceLyricInfo.cs,osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TimeTagCreateConfigSubsection.cs,osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Markdown/InputKeyText.cs,osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs

This comment does not works in the local.

Can simply this comment into:

dotnet format --check --dry-run --files osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Notes/NotePropertyChangeHandlerTest.cs

Maybe need to consider to use another github action?

@andy840119
Copy link
Member Author

andy840119 commented Jul 22, 2023

https://github.com/karaoke-dev/dotnet-format

Guess should make and folk and fix it myself 😢

Follow the change to fix this issue:
xt0rted/dotnet-format#406

And need to create a github action in that repo for able to auto-trigger the release build and add the file if using the tagged release.
see: https://docs.github.com/ja/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-using-yarn

@andy840119
Copy link
Member Author

天啊想用個 dotnet format 怎麼那麼麻煩 orz

@andy840119
Copy link
Member Author

image
Disabled this action manually.
Will re-enable it after fixed(or trying to fix it.)

@andy840119 andy840119 added the Good for contributor Those issues does not UX or behavior-related, so did not need lots of discussion. label Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improve code quality. Good for contributor Those issues does not UX or behavior-related, so did not need lots of discussion.
Projects
None yet
Development

No branches or pull requests

1 participant