.swiftformat 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Language version.
  2. --swiftversion 5.6
  3. # Ignore generated files.
  4. --exclude **/LinuxMain.swift,**/XCTestManifests.swift,**/*.grpc.swift,**/*.pb.swift
  5. --exclude Sources/GRPCSampleData/GRPCSwiftCertificate.swift
  6. --indent 2
  7. --maxwidth 100
  8. # Require explicit self
  9. --self insert
  10. # Only remove unused args in closures.
  11. --stripunusedargs closure-only
  12. # Wrap before the first argument (if wrapping is necessary).
  13. --wraparguments before-first
  14. # Don't indent #if blocks
  15. --ifdef no-indent
  16. # Don't turn Optional<Foo> into Foo?
  17. --shortoptionals except-properties
  18. # This rule doesn't always work as we'd expect: specifically when we return a
  19. # succeeded future whose type is a closure then that closure is incorrectly
  20. # treated as a trailing closure. This is relevant because the service provider
  21. # API for client streaming RPCs has this exact shape.
  22. --disable trailingClosures
  23. # Don't wrap the opening brace of multiline statements.
  24. --disable wrapMultilineStatementBraces
  25. # We used to support 5.0 and return is redundant in more places in 5.1: enabling
  26. # this rule creates a large (and unnecessary) diff.
  27. --disable redundantReturn
  28. # Don't prefer using key paths for trivial closures.
  29. --disable preferKeyPath
  30. # Put ACLs on declarations within an extension rather than the extension itself.
  31. --extensionacl on-declarations
  32. # Don't remove internal ACLs
  33. --disable redundantInternal
  34. # Don't remove redundant parenstheses, because no all of them are redundant.
  35. --disable redundantParens
  36. # Don't remove static Self
  37. --disable redundantStaticSelf
  38. # Hoisting try and await causes a bunch of issues (and churn) in 0.52.0. Disable
  39. # them for the time being.
  40. --disable hoistTry
  41. --disable hoistAwait
  42. # Disabled as enabling causes a lot of churn.
  43. --disable wrapSingleLineComments