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

Add .swiftformat and apply a lint check in CI #929

Merged
merged 2 commits into from
Aug 11, 2020

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Aug 10, 2020

Motivation:

The code style used by gRPC Swift is quite different from what most
contributors are used to, indenting with two spaces instead of Xcode's default
of four, for example. This is often irritating for contributors since
they need to adjust their Xcode settings and reformat their code to
match our style, and also for reviewers since they need to highlight
these differences.

Modifications:

  • Add a .swiftformat configuration file and ensure it's validated as
    part of the CI preflight checks
  • Apply swiftformat to baseline the formatting

Result:

  • CI will check fail before running test if there are formatting
    violations
  • Users can run fix their formatting by running 'swiftformat .' in the
    root of the repository

@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Aug 10, 2020
@glbrntt glbrntt requested a review from Lukasa August 10, 2020 13:09
@glbrntt
Copy link
Collaborator Author

glbrntt commented Aug 10, 2020

The first commit in this PR is the configuration and enabling a link check in CI. The second commit is the result of baselining the formatting.

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Shiny, looks good.

Motivation:

The code style used by gRPC Swift is quite different from what most
contributors are used to, indenting with two spaces instead of Xcode's default
of four, for example. This is often irritating for contributors since
they need to adjust their Xcode settings and reformat their code to
match our style, and also for reviewers since they need to highlight
these differences.

Modifications:

- Add a .swiftformat configuration file and ensure it's validated as
  part of the CI preflight checks
- Apply swiftformat to baseline the formatting

Result:

- CI will check fail before running test if there are formatting
  violations
- Users can run fix their formatting by running 'swiftformat .' in the
  root of the repository
@glbrntt glbrntt merged commit cf9649a into grpc:main Aug 11, 2020
@glbrntt glbrntt deleted the gb-formatter branch August 11, 2020 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants