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

Useswift-format for Swift file formatting#261

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
jasikpark merged 7 commits intomainfromuse-swift-format-script-for-formatting
Feb 20, 2025

Conversation

@jasikpark
Copy link
Contributor

@jasikparkjasikpark commentedFeb 20, 2025
edited
Loading

Try 3 of#254,#256

This adds a script calledswift-format.sh that ignores the files listed in.swiftformatignore while that feature is being added intoswiftlang/swift-format.

swift-format is shipped with XCode 16 and is included in the Github macos runners. There's a menuitem in XCode that allows formatting the file you're viewing. A good blog post is at:https://calebhearth.com/swift-format-github-action

Under Editor -> Structure -> Format with swift-format:

image

This script has been vendored fromswiftlang/github-workflows and adds a comment mentioning where it was vendored from and which edits have been made to it differing from the original source.

A quirk is that this script relies on the ignore file being at the top level, so it's a bit brittle. We could honestly just hardcode the ignore value in the script, but 🤷

#263 will enable the format check and format all swift code, then a PR after that will git blame ignore the formatting PR.

Testing

To test, you can run./swift-format.sh from the root of the repo and see that swift code is formatted. To test the "check" run./swift-format.sh check and see that there is a git diff outputted and that the exit code was unsuccessful.

You may also see a failed run athttps://github.com/DefinedNet/mobile_nebula/actions/runs/13444683597/job/37567211304?pr=261 while it still exists.

Refs:

@jasikparkjasikpark marked this pull request as ready for reviewFebruary 20, 2025 20:51
@jasikparkjasikparkforce-pushed theuse-swift-format-script-for-formatting branch 2 times, most recently from0fc8938 to597eb27CompareFebruary 20, 2025 21:07
@jasikparkjasikpark merged commit4d34083 intomainFeb 20, 2025
4 checks passed
@jasikparkjasikpark deleted the use-swift-format-script-for-formatting branchFebruary 20, 2025 22:09
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@IanVSIanVSIanVS approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jasikpark@IanVS

[8]ページ先頭

©2009-2025 Movatter.jp