diff --git a/.swiftformat b/.swiftformat index 0ff6972459..33613e9cd5 100644 --- a/.swiftformat +++ b/.swiftformat @@ -63,6 +63,11 @@ --enable hoistTry +--enable indent +--indent 4 +--indentcase true +--indentstrings true + # Disabled rules --disable blankLinesBetweenImports diff --git a/Apps/LekaApp/Sources/Data/TilesContent.swift b/Apps/LekaApp/Sources/Data/TilesContent.swift index 27d6df57e3..5f94b1db8b 100644 --- a/Apps/LekaApp/Sources/Data/TilesContent.swift +++ b/Apps/LekaApp/Sources/Data/TilesContent.swift @@ -40,7 +40,7 @@ enum TileData: Int, CaseIterable, Hashable { title: "Les parcours", subtitle: "Les parcours sont des compilations d'activités dont la difficulté est évolutive.", message: - "Les parcours ont pour objectif d'atteindre des compétences précises. Ils ont été pensé avec des professionnels du médico-social. \nVous pouvez réaliser les activités dans l'ordre ou sauter des niveaux." + "Les parcours ont pour objectif d'atteindre des compétences précises. Ils ont été pensé avec des professionnels du médico-social. \nVous pouvez réaliser les activités dans l'ordre ou sauter des niveaux." ) case .activities: return TileContent( @@ -48,16 +48,16 @@ enum TileData: Int, CaseIterable, Hashable { title: "Les activités", subtitle: "Les activités vous permettent de travailler des compétences variées !", message: - "Vous trouverez au sein de votre application diverses activités variées. Elles peuvent intéresser les différents métiers du médico-social afin de faire progresser les utilisateurs." + "Vous trouverez au sein de votre application diverses activités variées. Elles peuvent intéresser les différents métiers du médico-social afin de faire progresser les utilisateurs." ) case .commands: return TileContent( image: "gamecontroller", title: "Les commandes", subtitle: - "Les commandes vous permettent de créer des activités en utilisant Leka comme médiateur !", + "Les commandes vous permettent de créer des activités en utilisant Leka comme médiateur !", message: - "Vous pouvez télécommander Leka, le faire tourner, lancer un renforçateur ou encore allumer ses leds dans la couleur souhaitée ! \nL'objectif des commandes est de vous permettre de créer votre propre activité avec l'utilisateur et d'entrer en interaction avec lui." + "Vous pouvez télécommander Leka, le faire tourner, lancer un renforçateur ou encore allumer ses leds dans la couleur souhaitée ! \nL'objectif des commandes est de vous permettre de créer votre propre activité avec l'utilisateur et d'entrer en interaction avec lui." ) // New company signup path case .signupBravo: @@ -77,7 +77,7 @@ enum TileData: Int, CaseIterable, Hashable { image: DesignKitAsset.Images.user.name, title: "ÉTAPE 2 :", message: - "Nous allons maintenant créer votre premier \nprofil utilisateur (le profil d'une personne que \nvous accompagnez).", + "Nous allons maintenant créer votre premier \nprofil utilisateur (le profil d'une personne que \nvous accompagnez).", callToActionLabel: "Créer") case .signupFinalStep: return TileContent( diff --git a/Apps/LekaApp/Sources/Models/CompanyModel.swift b/Apps/LekaApp/Sources/Models/CompanyModel.swift index 52f6d2f7d5..42b29d9d26 100644 --- a/Apps/LekaApp/Sources/Models/CompanyModel.swift +++ b/Apps/LekaApp/Sources/Models/CompanyModel.swift @@ -49,8 +49,8 @@ struct User: Profile { enum Professions: String, Identifiable, CaseIterable { // swiftlint:disable identifier_name case educSpe, eje, monit, monitAt, teach, ASC, psychoMot, - ergo, ortho, kine, pedopsy, med, psy, infir, soign, - AESH, AES, AVDH, auxVieScol, pueri, auxPueri, ludo + ergo, ortho, kine, pedopsy, med, psy, infir, soign, + AESH, AES, AVDH, auxVieScol, pueri, auxPueri, ludo // swiftlint:enable identifier_name var id: Self { self } diff --git a/Apps/LekaApp/Sources/Stores/ActivityViewModel.swift b/Apps/LekaApp/Sources/Stores/ActivityViewModel.swift index 95b8a7ca3c..3d4c3bed1e 100644 --- a/Apps/LekaApp/Sources/Stores/ActivityViewModel.swift +++ b/Apps/LekaApp/Sources/Stores/ActivityViewModel.swift @@ -73,7 +73,7 @@ class ActivityViewModel: NSObject, ObservableObject, YamlFileDecodable { utterance.rate = 0.40 utterance.voice = Locale.current.language.languageCode?.identifier == "fr" - ? AVSpeechSynthesisVoice(language: "fr-FR") : AVSpeechSynthesisVoice(language: "en-US") + ? AVSpeechSynthesisVoice(language: "fr-FR") : AVSpeechSynthesisVoice(language: "en-US") isSpeaking = true synth.speak(utterance) diff --git a/Apps/LekaApp/Sources/Views/Sidebar/Components/Header/RobotButton/Components/RobotConnectionIndicator.swift b/Apps/LekaApp/Sources/Views/Sidebar/Components/Header/RobotButton/Components/RobotConnectionIndicator.swift index 05531edd47..3dd0b96d2e 100644 --- a/Apps/LekaApp/Sources/Views/Sidebar/Components/Header/RobotButton/Components/RobotConnectionIndicator.swift +++ b/Apps/LekaApp/Sources/Views/Sidebar/Components/Header/RobotButton/Components/RobotConnectionIndicator.swift @@ -25,7 +25,7 @@ struct RobotConnectionIndicator: View { Image( uiImage: - robotViewModel.isConnected + robotViewModel.isConnected ? DesignKitAsset.Images.robotConnected.image : DesignKitAsset.Images.robotDisconnected.image ) .resizable() diff --git a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV100.swift b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV100.swift index f0dc81431e..54fe924cbc 100644 --- a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV100.swift +++ b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV100.swift @@ -220,7 +220,7 @@ private class StateSendingFile: GKState, StateEventProcessor { let startIndex = currentPacket * maximumPacketSize let endIndex = currentPacket < expectedCompletePackets - ? startIndex + maximumPacketSize - 1 : startIndex + expectedRemainingBytes - 1 + ? startIndex + maximumPacketSize - 1 : startIndex + expectedRemainingBytes - 1 let dataToSend = globalFirmwareManager.data[startIndex...endIndex] diff --git a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift index 9a6e0b8ff9..db2e0946fc 100644 --- a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift +++ b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift @@ -280,7 +280,7 @@ private class StateSendingFile: GKState, StateEventProcessor { let startIndex = currentPacket * maximumPacketSize let endIndex = currentPacket < expectedCompletePackets - ? startIndex + maximumPacketSize - 1 : startIndex + expectedRemainingBytes - 1 + ? startIndex + maximumPacketSize - 1 : startIndex + expectedRemainingBytes - 1 let dataToSend = globalFirmwareManager.data[startIndex...endIndex] @@ -510,7 +510,7 @@ class UpdateProcessV130: UpdateProcessProtocol { case is StateInitial: currentStage.send(.initial) case is StateLoadingUpdateFile, is StateSettingFileExchangeState, is StateSettingDestinationPath, - is StateClearingFile, is StateSendingFile: + is StateClearingFile, is StateSendingFile: currentStage.send(.sendingUpdate) case is StateApplyingUpdate, is StateWaitingForRobotToReboot: currentStage.send(.installingUpdate) diff --git a/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/ForgotPasswordView.swift b/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/ForgotPasswordView.swift index 8041df1287..12beaec7c9 100644 --- a/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/ForgotPasswordView.swift +++ b/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/ForgotPasswordView.swift @@ -31,7 +31,7 @@ struct ForgotPasswordView: View { .textFieldStyle(.roundedBorder) .keyboardType(.emailAddress) if !organisation.mail.isEmpty, - !organisation.isEmailValid() { + !organisation.isEmailValid() { Text(organisation.invalidEmailAddressText) .font(.footnote) .foregroundStyle(.red) diff --git a/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/LoginView.swift b/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/LoginView.swift index 3b9ecef204..dde1cf1199 100644 --- a/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/LoginView.swift +++ b/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/LoginView.swift @@ -33,7 +33,7 @@ struct LoginView: View { .textFieldStyle(.roundedBorder) .keyboardType(.emailAddress) if !organisation.mail.isEmpty, - !organisation.isEmailValid() { + !organisation.isEmailValid() { Text(organisation.invalidEmailAddressText) .font(.footnote) .foregroundStyle(.red) @@ -47,7 +47,7 @@ struct LoginView: View { SecureField("password", text: $organisation.password) .textFieldStyle(.roundedBorder) if !organisation.password.isEmpty, - !organisation.isPasswordValid(organisation.password) { + !organisation.isPasswordValid(organisation.password) { Text(organisation.invalidPasswordText) .font(.footnote) .lineLimit(2) diff --git a/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/SignupView.swift b/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/SignupView.swift index 33b388cc32..9beb08a3d3 100644 --- a/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/SignupView.swift +++ b/Modules/AccountKit/Examples/AccountKitExample/Sources/Views/SignupView.swift @@ -32,7 +32,7 @@ struct SignupView: View { .textFieldStyle(.roundedBorder) .keyboardType(.emailAddress) if !organisation.mail.isEmpty, - !organisation.isEmailValid() { + !organisation.isEmailValid() { Text(organisation.invalidEmailAddressText) .font(.footnote) .foregroundStyle(.red) @@ -46,7 +46,7 @@ struct SignupView: View { SecureField("password", text: $organisation.password) .textFieldStyle(.roundedBorder) if !organisation.password.isEmpty, - !organisation.isPasswordValid(organisation.password) { + !organisation.isPasswordValid(organisation.password) { Text(organisation.invalidPasswordText) .font(.footnote) .lineLimit(2) @@ -61,8 +61,8 @@ struct SignupView: View { SecureField("confirm password", text: $organisation.confirmPassword) .textFieldStyle(.roundedBorder) if !organisation.password.isEmpty, - (!organisation.confirmPassword.isEmpty - && !organisation.passwordsMatch()) { + (!organisation.confirmPassword.isEmpty + && !organisation.passwordsMatch()) { Text(organisation.invalidConfirmPasswordText) .font(.footnote) .foregroundStyle(.red) diff --git a/Modules/BLEKit/Sources/Models/AdvertisingServiceData.swift b/Modules/BLEKit/Sources/Models/AdvertisingServiceData.swift index d40dbb0647..c2e2f58147 100644 --- a/Modules/BLEKit/Sources/Models/AdvertisingServiceData.swift +++ b/Modules/BLEKit/Sources/Models/AdvertisingServiceData.swift @@ -42,7 +42,7 @@ private func getOsVersion(data: Data) -> String? { let minor = data[AdvertisingServiceDataIndex.osVersionMinor] let revision = Int(data[AdvertisingServiceDataIndex.osVersionRevisionHighByte]) << 8 - + Int(data[AdvertisingServiceDataIndex.osVersionRevisionLowByte]) + + Int(data[AdvertisingServiceDataIndex.osVersionRevisionLowByte]) return "\(major).\(minor).\(revision)" } diff --git a/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift b/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift index 06ec8f22f9..20986b5e46 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise+Action.swift @@ -112,7 +112,7 @@ public extension Exercise { forKey: .type, in: container, debugDescription: - "Cannot decode ExercisePayload. Available keys: \(container.allKeys.map { $0.stringValue })" + "Cannot decode ExercisePayload. Available keys: \(container.allKeys.map { $0.stringValue })" ) } } diff --git a/Modules/ContentKit/Sources/Exercise/Exercise.swift b/Modules/ContentKit/Sources/Exercise/Exercise.swift index e5a913e47f..b8b7ba939c 100644 --- a/Modules/ContentKit/Sources/Exercise/Exercise.swift +++ b/Modules/ContentKit/Sources/Exercise/Exercise.swift @@ -28,9 +28,9 @@ public struct Exercise: Codable { switch (interface, gameplay) { case (.touchToSelect, .findTheRightAnswers), - (.listenThenTouchToSelect, .findTheRightAnswers), - (.observeThenTouchToSelect, .findTheRightAnswers), - (.robotThenTouchToSelect, .findTheRightAnswers): + (.listenThenTouchToSelect, .findTheRightAnswers), + (.observeThenTouchToSelect, .findTheRightAnswers), + (.robotThenTouchToSelect, .findTheRightAnswers): payload = try container.decode(TouchToSelect.Payload.self, forKey: .payload) case (.dragAndDropIntoZones, .findTheRightAnswers): @@ -49,7 +49,7 @@ public struct Exercise: Codable { payload = try container.decode(MusicalInstrument.Payload.self, forKey: .payload) case (.remoteStandard, .none), - (.remoteArrow, .none): + (.remoteArrow, .none): payload = nil default: diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/DragAndDrop/IntoZones/DragAndDropIntoZonesView+0_BaseScene.swift b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/DragAndDrop/IntoZones/DragAndDropIntoZonesView+0_BaseScene.swift index 47abce2adb..f8400a7cfc 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/DragAndDrop/IntoZones/DragAndDropIntoZonesView+0_BaseScene.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/DragAndDrop/IntoZones/DragAndDropIntoZonesView+0_BaseScene.swift @@ -220,7 +220,7 @@ extension DragAndDropIntoZonesView { let location = touch.location(in: self) if let node = self.atPoint(location) as? DraggableImageAnswerNode { for choice in viewModel.choices - where node.id == choice.id && node.isDraggable { + where node.id == choice.id && node.isDraggable { selectedNodes[touch] = node onDragAnimation(node) node.zPosition += 100 diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/Instrument/MusicalInstrumentView.swift b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/Instrument/MusicalInstrumentView.swift index 20d7260e3a..09f868de87 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/Instrument/MusicalInstrumentView.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Exercises/Specialized/Instrument/MusicalInstrumentView.swift @@ -23,7 +23,7 @@ struct MusicalInstrumentView: View { } guard let instrument = MIDIInstrument(rawValue: payload.instrument), - let scale = MIDIScale(rawValue: payload.scale) + let scale = MIDIScale(rawValue: payload.scale) else { fatalError("Instrument or scale not found") } diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/AssociateCategories/GameplayAssociateCategories.swift b/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/AssociateCategories/GameplayAssociateCategories.swift index 7d149cbbf9..3c6017709b 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/AssociateCategories/GameplayAssociateCategories.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/AssociateCategories/GameplayAssociateCategories.swift @@ -7,7 +7,7 @@ import ContentKit import Foundation class GameplayAssociateCategories: StatefulGameplayProtocol -where ChoiceModelType: GameplayChoiceModelProtocol { + where ChoiceModelType: GameplayChoiceModelProtocol { var choices: CurrentValueSubject<[GameplayAssociateCategoriesChoiceModel], Never> = .init([]) var state: CurrentValueSubject = .init(.idle) diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/FindTheRightAnswers/GameplayFindTheRightAnswers.swift b/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/FindTheRightAnswers/GameplayFindTheRightAnswers.swift index 13687397ec..a099ad2914 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/FindTheRightAnswers/GameplayFindTheRightAnswers.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Gameplays/FindTheRightAnswers/GameplayFindTheRightAnswers.swift @@ -7,7 +7,7 @@ import ContentKit import Foundation class GameplayFindTheRightAnswers: StatefulGameplayProtocol -where ChoiceModelType: GameplayChoiceModelProtocol { + where ChoiceModelType: GameplayChoiceModelProtocol { var choices: CurrentValueSubject<[ChoiceModelType], Never> = .init([]) var rightAnswers: [ChoiceModelType] = [] var state: CurrentValueSubject = .init(.idle) diff --git a/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityProgressBar.swift b/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityProgressBar.swift index 7b482d1afb..c21ab4cc4f 100644 --- a/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityProgressBar.swift +++ b/Modules/GameEngineKit/Sources/_NewSystem/Views/Activity/ActivityProgressBar.swift @@ -20,8 +20,8 @@ struct ActivityProgressBar: View { let dotColor: Color = { guard sequenceIndex < viewModel.currentSequenceIndex - || (sequenceIndex == viewModel.currentSequenceIndex - && exerciseIndex < viewModel.currentExerciseIndexInSequence) + || (sequenceIndex == viewModel.currentSequenceIndex + && exerciseIndex < viewModel.currentExerciseIndexInSequence) else { return .white } diff --git a/Modules/LocalizationKit/Examples/LocalizationKitExample/Sources/LocalizationView.swift b/Modules/LocalizationKit/Examples/LocalizationKitExample/Sources/LocalizationView.swift index f9952bc9f8..807a836edb 100644 --- a/Modules/LocalizationKit/Examples/LocalizationKitExample/Sources/LocalizationView.swift +++ b/Modules/LocalizationKit/Examples/LocalizationKitExample/Sources/LocalizationView.swift @@ -21,7 +21,7 @@ extension l10n { static let localizedStringInterpolationWithMarkdown = LocalizedStringInterpolation( "localized_string_interpolation_with_markdown", value: - "⛳ **DEFAULT** *localized_string_interpolation_with_markdown* - **text: %@** - *int: %lld* - ***float: %f***", + "⛳ **DEFAULT** *localized_string_interpolation_with_markdown* - **text: %@** - *int: %lld* - ***float: %f***", comment: "") } diff --git a/Modules/RobotKit/Sources/Robot+Lights.swift b/Modules/RobotKit/Sources/Robot+Lights.swift index 49cd9f9d70..9888d0b649 100644 --- a/Modules/RobotKit/Sources/Robot+Lights.swift +++ b/Modules/RobotKit/Sources/Robot+Lights.swift @@ -67,17 +67,17 @@ public extension Robot { public var color: Robot.Color { switch self { case let .all(color), - let .full(_, color), - let .halfLeft(color), - let .halfRight(color), - let .quarterFrontLeft(color), - let .quarterFrontRight(color), - let .quarterBackLeft(color), - let .quarterBackRight(color), - let .earLeft(color), - let .earRight(color), - let .spot(_, _, color), - let .range(_, _, color): + let .full(_, color), + let .halfLeft(color), + let .halfRight(color), + let .quarterFrontLeft(color), + let .quarterFrontRight(color), + let .quarterBackLeft(color), + let .quarterBackRight(color), + let .earLeft(color), + let .earRight(color), + let .spot(_, _, color), + let .range(_, _, color): return color } }