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

Simplify swift-format soundness script #108

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

simonjbeaumont
Copy link
Collaborator

Motivation

The run-swift-format.sh script run as part of soundness explicitly lists the directories to format. This is to avoid running swift-format on the contents of .build/ which contains a checkouts of all the dependencies. This isn't necessary, as we can use Git to tell us what files need to be formatted, which can also make for a more robust script/command as we add new directories.

Additionally, with the previous strategy, Package.swift at the root of the repository was ignored. This was deliberate, but in hindsight I don't think the lack of trailing comma enforcement is worth us excluding it.

Modifications

  • Use git ls-files to determine which files need to be passed to swift-format.

Result

  • Script is simpler (also easier to add a one-shot command as a pre-commit hook).
  • Package.swift is also formatted.

Test Plan

None.

@simonjbeaumont simonjbeaumont marked this pull request as ready for review July 10, 2023 09:22
@simonjbeaumont simonjbeaumont requested a review from czechboy0 July 10, 2023 09:22
Copy link
Contributor

@czechboy0 czechboy0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Net-negative line count, a simplified script, and more consistent code. What are you, a magician? 🙂💯

@czechboy0
Copy link
Contributor

@swift-server-bot test this please

@simonjbeaumont simonjbeaumont added the semver/none No version bump required. label Jul 11, 2023
@simonjbeaumont simonjbeaumont enabled auto-merge (squash) July 11, 2023 09:47
@simonjbeaumont simonjbeaumont merged commit 23b982d into apple:main Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants