swiftformat.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #! /bin/sh
  2. function assertEnvironment {
  3. if [ -z $1 ]; then
  4. echo $2
  5. exit 127
  6. fi
  7. }
  8. assertEnvironment "${SRCROOT}" "Please set SRCROOT to project root folder"
  9. unset SDKROOT
  10. swift run -c release --package-path BuildTools swiftformat "${SRCROOT}" \
  11. --enable andOperator,\
  12. anyObjectProtocol,\
  13. blankLinesAroundMark,\
  14. blankLinesAtEndOfScope,\
  15. blankLinesAtStartOfScope,\
  16. blankLinesBetweenScopes,\
  17. consecutiveBlankLines,\
  18. consecutiveSpaces,\
  19. duplicateImports,\
  20. elseOnSameLine,\
  21. emptyBraces,\
  22. enumNamespaces,\
  23. fileHeader,\
  24. hoistPatternLet,\
  25. indent,\
  26. isEmpty,\
  27. leadingDelimiters,\
  28. linebreakAtEndOfFile,\
  29. linebreaks,\
  30. modifierOrder,\
  31. numberFormatting,\
  32. preferKeyPath,\
  33. redundantBackticks,\
  34. redundantBreak,\
  35. redundantExtensionACL,\
  36. redundantFileprivate,\
  37. redundantGet,\
  38. redundantLet,\
  39. redundantLetError,\
  40. redundantNilInit,\
  41. redundantObjc,\
  42. redundantParens,\
  43. redundantPattern,\
  44. redundantRawValues,\
  45. redundantReturn,\
  46. redundantSelf,\
  47. redundantType,\
  48. redundantVoidReturnType,\
  49. semicolons,\
  50. sortedImports,\
  51. sortedSwitchCases,\
  52. spaceAroundBraces,\
  53. spaceAroundBrackets,\
  54. spaceAroundComments,\
  55. spaceAroundGenerics,\
  56. spaceAroundOperators,\
  57. spaceAroundParens,\
  58. spaceInsideBraces,\
  59. spaceInsideBrackets,\
  60. spaceInsideComments,\
  61. spaceInsideGenerics,\
  62. spaceInsideParens,\
  63. strongOutlets,\
  64. strongifiedSelf,\
  65. todos,\
  66. trailingCommas,\
  67. trailingSpace,\
  68. typeSugar,\
  69. unusedArguments,\
  70. void,\
  71. wrap,\
  72. wrapArguments,\
  73. wrapAttributes,\
  74. wrapEnumCases,\
  75. wrapMultilineStatementBraces,\
  76. wrapSwitchCases \
  77. --disable braces,\
  78. redundantInit,\
  79. trailingClosures \
  80. --commas inline \
  81. --exponentcase uppercase \
  82. --header strip \
  83. --hexliteralcase uppercase \
  84. --ifdef indent \
  85. --indent 4 \
  86. --self remove \
  87. --semicolons never \
  88. --swiftversion 5.2 \
  89. --trimwhitespace always \
  90. --maxwidth 130 \
  91. --wraparguments before-first \
  92. --funcattributes same-line \
  93. --typeattributes same-line \
  94. --varattributes same-line \
  95. --wrapcollections before-first \
  96. --exclude Pods \
  97. --exclude Generated \
  98. --exclude R.generated.swift \
  99. --exclude fastlane/swift \
  100. --exclude Dependencies \
  101. --exclude LoopKit \
  102. --exclude LibreTransmitter \
  103. --exclude G7SensorKit \
  104. --exclude dexcom-share-client-swift \
  105. --exclude CGMBLEKit \
  106. --exclude RileyLinkKit \
  107. --exclude MinimedKit \
  108. --exclude TidepoolService \
  109. --exclude DanaKit \
  110. --exclude MedtrumKit \
  111. --exclude OmnipodKit \
  112. --exclude LibreLoop \
  113. --exclude LibreCRKit \
  114. --exclude LoopAlgorithm