Skip to content

Commit

Permalink
Update Swiftformat to 0.52.4 (tuist#5458)
Browse files Browse the repository at this point in the history
* Update swiftformat

* Fix issues

* Fix formatting issues

* Delete fourier pipeline

Fourier is going away so I'm eliminate it to prevent spending time on something
that will eventually disappear from the codebase
  • Loading branch information
pepicrft authored Sep 29, 2023
1 parent 72ef11d commit 31d95b0
Show file tree
Hide file tree
Showing 283 changed files with 701 additions and 604 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/fourier.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
--symlinks ignore
--exclude Tests/XCTestManifests.swift,projects/tuist/features,Sources/TuistSupport/Vendored,projects/tuist/fixtures/Targets/SlothCreator,Sources/TuistCloud/OpenAPI,Sources/TuistAutomation/XcodeBuild/XcodeBuildController.swift
--exclude projects/tuist/fixtures/tuist_plugin
--disable hoistAwait
--disable hoistTry
--swiftversion 5.7

# format options

Expand Down
5 changes: 3 additions & 2 deletions Sources/ProjectAutomation/Tuist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum Tuist {

/// Loads and returns the graph at the given path.
/// - parameter path: the path which graph should be loaded. If nil, the current path is used.
/// - parameter environmentKeys: the environment keys that should be copied. If empty, no environment variables will be passed.
/// - parameter environmentKeys: the environment keys that should be copied. If empty, no environment variables will be
/// passed.
public static func graph(at path: String? = nil, environmentKeys: Set<String> = []) throws -> Graph {
// If a task is executed via `tuist`, it gets passed the binary path as a last argument.
// Otherwise, fallback to go
Expand All @@ -40,7 +41,7 @@ public enum Tuist {
"--format", "json",
"--output-path", graphPath.parentDirectory.pathString,
]
if let path = path {
if let path {
arguments += ["--path", path]
}
let forceConfigCacheDirectory = "TUIST_CONFIG_FORCE_CONFIG_CACHE_DIRECTORY"
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/BuildRule+CompilerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Foundation

extension BuildRule {
/// The type of compiler spec which is used for a selected file type.
/// All the values are taken from build rule options hidden under a pup-up button's menu next to a label `Using` in a target's `Build Rules` section.
/// All the values are taken from build rule options hidden under a pup-up button's menu next to a label `Using` in a target's
/// `Build Rules` section.
public enum CompilerSpec: Codable {
case appIntentsMetadataExtractor
case appShortcutStringsMetadataExtractor
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/BuildRule+FileType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Foundation

extension BuildRule {
/// File types processed by a build rule.
/// All the values are taken from build rule options hidden under a pup-up button's menu next to a label `Process` in a target's `Build Rules` section.
/// All the values are taken from build rule options hidden under a pup-up button's menu next to a label `Process` in a
/// target's `Build Rules` section.
public enum FileType: Codable {
case instrumentsPackageDefinition
case metalAIR
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/Cache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public struct Cache: Codable, Equatable {

/// Returns a `Cache` instance containing the given profiles.
/// If no profile list is provided, tuist's default profile will be taken as the default.
/// If no profile is provided in `tuist cache --profile` command, the first profile from the profiles list will be taken as the default.
/// If no profile is provided in `tuist cache --profile` command, the first profile from the profiles list will be taken as
/// the default.
/// - Parameters:
/// - profiles: Profiles to be chosen from
/// - path: The path where the cache will be stored, if `nil` it will be a default location in a shared directory.
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/Cloud.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public struct Cloud: Codable, Equatable {
case disableAnalytics

/// Marks whether cloud connection is optional.
/// If not present, tuist commands will fail regardless of whether an authentication token is available locally from `tuist cloud auth` or not.
/// If not present, tuist commands will fail regardless of whether an authentication token is available locally from
/// `tuist cloud auth` or not.
case optional
}

Expand Down
9 changes: 6 additions & 3 deletions Sources/ProjectDescription/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
///
/// Tuist can be configured through a shared `Config.swift` manifest.
/// When Tuist is executed, it traverses up the directories to find a `Tuist` directory containing a `Config.swift` file.
/// Defining a configuration manifest is not required, but recommended to ensure a consistent behaviour across all the projects that are part of the repository.
/// Defining a configuration manifest is not required, but recommended to ensure a consistent behaviour across all the projects
/// that are part of the repository.
///
/// The example below shows a project that has a global `Config.swift` file that will be used when Tuist is run from any of the subdirectories:
/// The example below shows a project that has a global `Config.swift` file that will be used when Tuist is run from any of the
/// subdirectories:
///
/// ```bash
/// /Workspace.swift
Expand Down Expand Up @@ -43,7 +45,8 @@ public struct Config: Codable, Equatable {

/// The Swift tools versions that will be used by Tuist to fetch external dependencies.
/// If `nil` is passed then Tuist will use the environment’s version.
/// - Note: This **does not** control the `SWIFT_VERSION` build setting in regular generated projects, for this please use `Project.settings`
/// - Note: This **does not** control the `SWIFT_VERSION` build setting in regular generated projects, for this please use
/// `Project.settings`
/// or `Target.settings` as needed.
public let swiftVersion: Version?

Expand Down
2 changes: 1 addition & 1 deletion Sources/ProjectDescription/ConfigurationName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public struct ConfigurationName: ExpressibleByStringLiteral, Codable, Equatable
/// The configuration name.
public let rawValue: String

internal init(_ rawValue: String) {
init(_ rawValue: String) {
self.rawValue = rawValue
}

Expand Down
6 changes: 4 additions & 2 deletions Sources/ProjectDescription/Dependencies/Dependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public struct Dependencies: Codable, Equatable {

/// Creates a new `Dependencies` manifest instance.
/// - Parameters:
/// - carthage: The description of dependencies that can be installed using Carthage. Pass `nil` if you don't have dependencies from Carthage.
/// - swiftPackageManager: The description of dependencies that can be installed using SPM. Pass `nil` if you don't have dependencies from SPM.
/// - carthage: The description of dependencies that can be installed using Carthage. Pass `nil` if you don't have
/// dependencies from Carthage.
/// - swiftPackageManager: The description of dependencies that can be installed using SPM. Pass `nil` if you don't have
/// dependencies from SPM.
/// - platforms: Set of platforms for which you want to install dependencies.
public init(
carthage: CarthageDependencies? = nil,
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/DeploymentTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Foundation

/// A supported minimum deployment target.
public enum DeploymentTarget: Codable, Hashable {
/// The minimum iOS version, the list of devices your product will support, and whether or not the target should run on mac devices.
/// The minimum iOS version, the list of devices your product will support, and whether or not the target should run on mac
/// devices.
case iOS(targetVersion: String, devices: DeploymentDevice, supportsMacDesignedForIOS: Bool = true)
/// The minimum macOS version your product will support.
case macOS(targetVersion: String)
Expand Down
2 changes: 1 addition & 1 deletion Sources/ProjectDescription/Dump.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

func dumpIfNeeded<E: Encodable>(_ entity: E) {
func dumpIfNeeded(_ entity: some Encodable) {
guard CommandLine.argc > 0,
CommandLine.arguments.contains("--tuist-dump")
else { return }
Expand Down
11 changes: 7 additions & 4 deletions Sources/ProjectDescription/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum Environment {
}
}

extension Optional where Wrapped == Environment.Value {
extension Environment.Value? {
/// Retrieve the Environment value as a string or return the specified default string value
/// - Parameters:
/// - default: default String value to be returned
Expand Down Expand Up @@ -60,7 +60,8 @@ extension String {
guard !isEmpty else { return self }

var words: [Range<String.Index>] = []
// The general idea of this algorithm is to split words on transition from lower to upper case, then on transition of >1 upper case characters to lowercase
// The general idea of this algorithm is to split words on transition from lower to upper case, then on transition of >1
// upper case characters to lowercase
//
// myProperty -> my_property
// myURLProperty -> my_url_property
Expand All @@ -83,14 +84,16 @@ extension String {
break
}

// Is the next lowercase letter more than 1 after the uppercase? If so, we encountered a group of uppercase letters that we should treat as its own word
// Is the next lowercase letter more than 1 after the uppercase? If so, we encountered a group of uppercase letters
// that we should treat as its own word
let nextCharacterAfterCapital = index(after: upperCaseRange.lowerBound)
if lowerCaseRange.lowerBound == nextCharacterAfterCapital {
// The next character after capital is a lower case character and therefore not a word boundary.
// Continue searching for the next upper case for the boundary.
wordStart = upperCaseRange.lowerBound
} else {
// There was a range of >1 capital letters. Turn those into a word, stopping at the capital before the lower case character.
// There was a range of >1 capital letters. Turn those into a word, stopping at the capital before the lower case
// character.
let beforeLowerIndex = index(before: lowerCaseRange.lowerBound)
words.append(upperCaseRange.lowerBound ..< beforeLowerIndex)

Expand Down
9 changes: 5 additions & 4 deletions Sources/ProjectDescription/FileElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import Foundation
/// Note: For convenience, an element can be represented as a string literal
/// `"some/pattern/**"` is the equivalent of `FileElement.glob(pattern: "some/pattern/**")`
public enum FileElement: Codable, Equatable {
/// A file path (or glob pattern) to include. For convenience, a string literal can be used as an alternate way to specify this option.
/// A file path (or glob pattern) to include. For convenience, a string literal can be used as an alternate way to specify
/// this option.
case glob(pattern: Path)

/// A directory path to include as a folder reference.
Expand All @@ -35,15 +36,15 @@ extension FileElement: ExpressibleByStringInterpolation {
}
}

extension Array: ExpressibleByUnicodeScalarLiteral where Element == FileElement {
extension [FileElement]: ExpressibleByUnicodeScalarLiteral {
public typealias UnicodeScalarLiteralType = String
}

extension Array: ExpressibleByExtendedGraphemeClusterLiteral where Element == FileElement {
extension [FileElement]: ExpressibleByExtendedGraphemeClusterLiteral {
public typealias ExtendedGraphemeClusterLiteralType = String
}

extension Array: ExpressibleByStringLiteral where Element == FileElement {
extension [FileElement]: ExpressibleByStringLiteral {
public typealias StringLiteralType = String

public init(stringLiteral value: String) {
Expand Down
6 changes: 4 additions & 2 deletions Sources/ProjectDescription/FileHeaderTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import Foundation

/// A header template from a file or a string.
///
/// Lets you define custom file header template for built-in Xcode templates, e.g. when you create new Swift file you can automatically have your custom define file header.
/// Lets you define custom file header template for built-in Xcode templates, e.g. when you create new Swift file you can
/// automatically have your custom define file header.
///
/// Tuist automatically performs several template transformations for you
/// - if your template starts with comment slashes (`//`) we remove them as they are added automatically by Xcode
/// - if your template doesn't start with comment and whitespace or newline, we add a space - otherwise your header would be glued to implicit comment slashes which you probably do not want
/// - if your template doesn't start with comment and whitespace or newline, we add a space - otherwise your header would be
/// glued to implicit comment slashes which you probably do not want
/// - if your template has trailing newline, we remove it as it is implicitly added by Xcode
public enum FileHeaderTemplate: Codable, Equatable, ExpressibleByStringInterpolation {
/// Load template stored in file
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/FileList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Foundation

/// A collection of file globs.
///
/// The list of files can be initialized with a string that represents the glob pattern, or an array of strings, which represents a list of glob patterns.
/// The list of files can be initialized with a string that represents the glob pattern, or an array of strings, which represents
/// a list of glob patterns.
public struct FileList: Codable, Equatable {
/// Glob pattern to the files.
public let globs: [FileListGlob]
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/InfoPlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public enum InfoPlist: Codable, Equatable {
/// A dictionary with the Info.plist content. Tuist generates the Info.plist file at the generation time.
case dictionary([String: Plist.Value])

/// Generate an Info.plist file with the default content for the target product extended with the values in the given dictionary.
/// Generate an Info.plist file with the default content for the target product extended with the values in the given
/// dictionary.
case extendingDefault(with: [String: Plist.Value])

/// Generate the default content for the target the InfoPlist belongs to.
Expand Down
4 changes: 2 additions & 2 deletions Sources/ProjectDescription/LaunchArgument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public struct LaunchArgument: Equatable, Codable {
}
}

extension Array where Element == LaunchArgument {
internal init(launchArguments: [String: Bool]) {
extension [LaunchArgument] {
init(launchArguments: [String: Bool]) {
self = launchArguments.map(LaunchArgument.init)
.sorted { $0.name < $1.name }
}
Expand Down
9 changes: 6 additions & 3 deletions Sources/ProjectDescription/MergedBinaryType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ public enum MergedBinaryType: Equatable, Codable {
/// Target is never going to merge available dependencies
case disabled

/// Target is going to merge direct target dependencies (just the ones declared as part of it's project). With this build setting,
/// Target is going to merge direct target dependencies (just the ones declared as part of it's project). With this build
/// setting,
/// Xcode treats mergeable dependencies like normal dynamic libraries in debug builds,
/// but performs steps in release mode to automatically handle merging for **direct dependencies**
///
Expand All @@ -20,10 +21,12 @@ public enum MergedBinaryType: Equatable, Codable {
///
/// In some cases, you may want to manually configure merging between your app or framework target and dependent libraries.
/// For example, you might not want to automatically merge dependencies that you share between an app and an app extension
/// if you’re concerned about the app extension’s binary size. To set up manual merging, configure your app or framework target,
/// if you’re concerned about the app extension’s binary size. To set up manual merging, configure your app or framework
/// target,
/// then configure your dependent libraries.
///
/// In your app or framework target, add the flag `mergedBinaryType` and set it to manual. After you add that setting to your target:
/// In your app or framework target, add the flag `mergedBinaryType` and set it to manual. After you add that setting to your
/// target:
/// - In release builds, Xcode merges the products of any of its direct dependencies which have
/// MAKE_MERGEABLE enabled using the linker flags -merge_framework, -merge-l and so on.
/// - In debug builds, Xcode links any of your target’s direct dependencies which have MERGEABLE_LIBRARY
Expand Down
6 changes: 4 additions & 2 deletions Sources/ProjectDescription/Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Foundation

/// A path represents to a file, directory, or a group of files represented by a glob expression.
///
/// Paths can be relative and absolute. We discourage using absolute paths because they create a dependency with the environment where they are defined.
/// Paths can be relative and absolute. We discourage using absolute paths because they create a dependency with the environment
/// where they are defined.
public struct Path: ExpressibleByStringInterpolation, Codable, Hashable {
public enum PathType: String, Codable {
case relativeToCurrentFile
Expand Down Expand Up @@ -34,7 +35,8 @@ public struct Path: ExpressibleByStringInterpolation, Codable, Hashable {
Path(pathString, type: .relativeToCurrentFile, callerPath: "\(callerPath)")
}

/// Initialize a path that is relative to the directory that contains the manifest file being loaded, for example the directory that contains the Project.swift file.
/// Initialize a path that is relative to the directory that contains the manifest file being loaded, for example the
/// directory that contains the Project.swift file.
public static func relativeToManifest(_ pathString: String) -> Path {
Path(pathString, type: .relativeToManifest)
}
Expand Down
3 changes: 2 additions & 1 deletion Sources/ProjectDescription/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Foundation
/// Supported plugins include:
/// - ProjectDescriptionHelpers
/// - These are plugins designed to be usable by any other manifest excluding `Config` and `Plugin`.
/// - The source files for these helpers must live under a ProjectDescriptionHelpers directory in the location where `Plugin` manifest lives.
/// - The source files for these helpers must live under a ProjectDescriptionHelpers directory in the location where `Plugin`
/// manifest lives.
///
public struct Plugin: Codable, Equatable {
/// The name of the `Plugin`.
Expand Down
Loading

0 comments on commit 31d95b0

Please sign in to comment.