Skip to content

Commit

Permalink
Add a swift-format check to run on PRs.
Browse files Browse the repository at this point in the history
Based off the swift-nio ones.
  • Loading branch information
thomasvl committed Sep 20, 2024
1 parent ba68a8e commit 4ddf45c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/swift-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: swift-format Check

on:
pull_request:
branches: [ main ]

jobs:
format-check:
name: swift-format Check
runs-on: ubuntu-latest
container:
# Use use the latest Swift release and that's the version of swift-format
# people should use.
image: swift:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run format check
run: |
set -eu
git ls-files -z '*.swift' | xargs -0 swift format format --parallel --in-place
GIT_PAGER='' git diff --exit-code '*.swift'
# Disabled as it produces multiple warnings at the moment.
# - name: Run format lint check
# run: |
# set -eu
# git ls-files -z '*.swift' | xargs -0 swift format lint --strict --parallel
3 changes: 1 addition & 2 deletions Sources/SwiftProtobuf/Internal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public enum Internal {
/// backing storage.
/// - Note: This isn't really used any longer - it's only here to support code generated by 1.10.2 and earlier.
@available(
*,
deprecated,
*, deprecated,
message:
"Internal.emptyData isn't used any longer in newer versions of the generator. Generate code with a version later than 1.10.2 to get performance improvements. See https://github.com/apple/swift-protobuf/pull/1028 for more information."
)
Expand Down

0 comments on commit 4ddf45c

Please sign in to comment.