mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Tweak swiftlint settings
This commit is contained in:
committed by
Stefan Ceriu
parent
10259e9345
commit
dd6d1f6e63
+5
-2
@@ -24,7 +24,7 @@ line_length:
|
|||||||
error: 1000
|
error: 1000
|
||||||
|
|
||||||
file_length:
|
file_length:
|
||||||
warning: 800
|
warning: 1000
|
||||||
error: 1000
|
error: 1000
|
||||||
|
|
||||||
type_name:
|
type_name:
|
||||||
@@ -38,9 +38,12 @@ type_body_length:
|
|||||||
error: 1000
|
error: 1000
|
||||||
|
|
||||||
function_body_length:
|
function_body_length:
|
||||||
warning: 50
|
warning: 100
|
||||||
error: 100
|
error: 100
|
||||||
|
|
||||||
|
cyclomatic_complexity:
|
||||||
|
ignores_case_statements: true
|
||||||
|
|
||||||
nesting:
|
nesting:
|
||||||
type_level:
|
type_level:
|
||||||
warning: 5
|
warning: 5
|
||||||
|
|||||||
@@ -241,7 +241,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
|
|||||||
userSessionStore.reset()
|
userSessionStore.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
private func setupStateMachine() {
|
private func setupStateMachine() {
|
||||||
stateMachine.addTransitionHandler { [weak self] context in
|
stateMachine.addTransitionHandler { [weak self] context in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
// swiftlint:disable:next function_body_length
|
||||||
private func setupStateMachine() {
|
private func setupStateMachine() {
|
||||||
stateMachine.addRouteMapping { event, fromState, _ in
|
stateMachine.addRouteMapping { event, fromState, _ in
|
||||||
switch (event, fromState) {
|
switch (event, fromState) {
|
||||||
@@ -258,7 +258,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
||||||
private func asyncPresentRoom(_ roomID: String, animated: Bool, destinationRoomProxy: RoomProxyProtocol? = nil) async {
|
private func asyncPresentRoom(_ roomID: String, animated: Bool, destinationRoomProxy: RoomProxyProtocol? = nil) async {
|
||||||
if let roomProxy, roomProxy.id == roomID {
|
if let roomProxy, roomProxy.id == roomID {
|
||||||
navigationStackCoordinator.popToRoot()
|
navigationStackCoordinator.popToRoot()
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
||||||
private func setupStateMachine() {
|
private func setupStateMachine() {
|
||||||
stateMachine.addTransitionHandler { [weak self] context in
|
stateMachine.addTransitionHandler { [weak self] context in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
@@ -241,7 +240,6 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
private func presentHomeScreen() {
|
private func presentHomeScreen() {
|
||||||
let parameters = HomeScreenCoordinatorParameters(userSession: userSession,
|
let parameters = HomeScreenCoordinatorParameters(userSession: userSession,
|
||||||
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL),
|
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL),
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ class UserSessionFlowCoordinatorStateMachine {
|
|||||||
configure()
|
configure()
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
private func configure() {
|
private func configure() {
|
||||||
stateMachine.addRoutes(event: .start, transitions: [.initial => .roomList(selectedRoomID: nil)])
|
stateMachine.addRoutes(event: .start, transitions: [.initial => .roomList(selectedRoomID: nil)])
|
||||||
stateMachine.addRoutes(event: .startWithMigration, transitions: [.initial => .migration])
|
stateMachine.addRoutes(event: .startWithMigration, transitions: [.initial => .migration])
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ extension UNMutableNotificationContent {
|
|||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next function_body_length
|
|
||||||
func addSenderIcon(using mediaProvider: MediaProviderProtocol?,
|
func addSenderIcon(using mediaProvider: MediaProviderProtocol?,
|
||||||
senderID: String,
|
senderID: String,
|
||||||
senderName: String,
|
senderName: String,
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
|
|
||||||
var callback: ((HomeScreenViewModelAction) -> Void)?
|
var callback: ((HomeScreenViewModelAction) -> Void)?
|
||||||
|
|
||||||
// swiftlint:disable:next function_body_length cyclomatic_complexity
|
|
||||||
init(userSession: UserSessionProtocol,
|
init(userSession: UserSessionProtocol,
|
||||||
attributedStringBuilder: AttributedStringBuilderProtocol,
|
attributedStringBuilder: AttributedStringBuilderProtocol,
|
||||||
selectedRoomPublisher: CurrentValuePublisher<String?, Never>,
|
selectedRoomPublisher: CurrentValuePublisher<String?, Never>,
|
||||||
@@ -156,7 +155,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
|
|
||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
override func process(viewAction: HomeScreenViewAction) {
|
override func process(viewAction: HomeScreenViewAction) {
|
||||||
switch viewAction {
|
switch viewAction {
|
||||||
case .selectRoom(let roomIdentifier):
|
case .selectRoom(let roomIdentifier):
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
|||||||
|
|
||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
override func process(viewAction: RoomDetailsScreenViewAction) {
|
override func process(viewAction: RoomDetailsScreenViewAction) {
|
||||||
switch viewAction {
|
switch viewAction {
|
||||||
case .processTapPeople:
|
case .processTapPeople:
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
|||||||
|
|
||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
func start() {
|
func start() {
|
||||||
viewModel.callback = { [weak self] action in
|
viewModel.callback = { [weak self] action in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
|
|
||||||
var callback: ((RoomScreenViewModelAction) -> Void)?
|
var callback: ((RoomScreenViewModelAction) -> Void)?
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
||||||
override func process(viewAction: RoomScreenViewAction) {
|
override func process(viewAction: RoomScreenViewAction) {
|
||||||
switch viewAction {
|
switch viewAction {
|
||||||
case .displayRoomDetails:
|
case .displayRoomDetails:
|
||||||
@@ -539,7 +538,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
item.isOutgoing || (canCurrentUserRedact && !roomProxy.isDirect)
|
item.isOutgoing || (canCurrentUserRedact && !roomProxy.isDirect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
||||||
private func processTimelineItemMenuAction(_ action: TimelineItemMenuAction, itemID: TimelineItemIdentifier) {
|
private func processTimelineItemMenuAction(_ action: TimelineItemMenuAction, itemID: TimelineItemIdentifier) {
|
||||||
guard let timelineItem = timelineController.timelineItems.firstUsingStableID(itemID),
|
guard let timelineItem = timelineController.timelineItems.firstUsingStableID(itemID),
|
||||||
let eventTimelineItem = timelineItem as? EventBasedTimelineItemProtocol else {
|
let eventTimelineItem = timelineItem as? EventBasedTimelineItemProtocol else {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct LongPressWithFeedback: ViewModifier {
|
|||||||
.animation(isLongPressing ? .spring(response: 0.5).delay(0.1) : .spring(response: 0.5),
|
.animation(isLongPressing ? .spring(response: 0.5).delay(0.1) : .spring(response: 0.5),
|
||||||
value: isLongPressing)
|
value: isLongPressing)
|
||||||
// The minimum duration here doesn't actually invoke the perform block when elapsed (thus
|
// The minimum duration here doesn't actually invoke the perform block when elapsed (thus
|
||||||
// the implementation bellow) but it does cancel other system gestures e.g. swipe to reply
|
// the implementation below) but it does cancel other system gestures e.g. swipe to reply
|
||||||
.onLongPressGesture(minimumDuration: 0.25) { } onPressingChanged: { isPressing in
|
.onLongPressGesture(minimumDuration: 0.25) { } onPressingChanged: { isPressing in
|
||||||
isLongPressing = isPressing
|
isLongPressing = isPressing
|
||||||
|
|
||||||
|
|||||||
-1
@@ -83,7 +83,6 @@ class SessionVerificationScreenStateMachine {
|
|||||||
configure()
|
configure()
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
private func configure() {
|
private func configure() {
|
||||||
stateMachine.addRoutes(event: .requestVerification, transitions: [.initial => .requestingVerification])
|
stateMachine.addRoutes(event: .requestVerification, transitions: [.initial => .requestingVerification])
|
||||||
stateMachine.addRoutes(event: .didAcceptVerificationRequest, transitions: [.requestingVerification => .verificationRequestAccepted])
|
stateMachine.addRoutes(event: .didAcceptVerificationRequest, transitions: [.requestingVerification => .verificationRequestAccepted])
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ class BugReportService: NSObject, BugReportServiceProtocol {
|
|||||||
SentrySDK.crash()
|
SentrySDK.crash()
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next function_body_length cyclomatic_complexity
|
|
||||||
func submitBugReport(_ bugReport: BugReport,
|
func submitBugReport(_ bugReport: BugReport,
|
||||||
progressListener: CurrentValueSubject<Double, Never>) async -> Result<SubmitBugReportResponse, BugReportServiceError> {
|
progressListener: CurrentValueSubject<Double, Never>) async -> Result<SubmitBugReportResponse, BugReportServiceError> {
|
||||||
var params = [
|
var params = [
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ struct RoomEventStringBuilder {
|
|||||||
self.stateEventStringBuilder = stateEventStringBuilder
|
self.stateEventStringBuilder = stateEventStringBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
func buildAttributedString(for eventItemProxy: EventTimelineItemProxy) -> AttributedString? {
|
func buildAttributedString(for eventItemProxy: EventTimelineItemProxy) -> AttributedString? {
|
||||||
let sender = eventItemProxy.sender
|
let sender = eventItemProxy.sender
|
||||||
let isOutgoing = eventItemProxy.isOwn
|
let isOutgoing = eventItemProxy.isOwn
|
||||||
|
|||||||
@@ -206,7 +206,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
||||||
private func buildDiff(from diff: RoomListEntriesUpdate, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
private func buildDiff(from diff: RoomListEntriesUpdate, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
||||||
var changes = [CollectionDifference<RoomSummary>.Change]()
|
var changes = [CollectionDifference<RoomSummary>.Change]()
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
|||||||
MXLog.verbose("Finished applying diffs, current items (\(itemProxies.count)) : \(itemProxies.map(\.debugIdentifier))")
|
MXLog.verbose("Finished applying diffs, current items (\(itemProxies.count)) : \(itemProxies.map(\.debugIdentifier))")
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
// swiftlint:disable:next cyclomatic_complexity
|
||||||
private func buildDiff(from diff: TimelineDiff, on itemProxies: [TimelineItemProxy]) -> CollectionDifference<TimelineItemProxy>? {
|
private func buildDiff(from diff: TimelineDiff, on itemProxies: [TimelineItemProxy]) -> CollectionDifference<TimelineItemProxy>? {
|
||||||
var changes = [CollectionDifference<TimelineItemProxy>.Change]()
|
var changes = [CollectionDifference<TimelineItemProxy>.Change]()
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import UIKit
|
|||||||
struct RoomStateEventStringBuilder {
|
struct RoomStateEventStringBuilder {
|
||||||
let userID: String
|
let userID: String
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
func buildString(for change: MembershipChange?, member: String, sender: TimelineItemSender, isOutgoing: Bool) -> String? {
|
func buildString(for change: MembershipChange?, member: String, sender: TimelineItemSender, isOutgoing: Bool) -> String? {
|
||||||
guard let change else {
|
guard let change else {
|
||||||
MXLog.verbose("Filtering timeline item for membership change that is nil")
|
MXLog.verbose("Filtering timeline item for membership change that is nil")
|
||||||
@@ -76,7 +75,7 @@ struct RoomStateEventStringBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_parameter_count
|
// swiftlint:disable:next function_parameter_count
|
||||||
func buildProfileChangeString(displayName: String?, previousDisplayName: String?,
|
func buildProfileChangeString(displayName: String?, previousDisplayName: String?,
|
||||||
avatarURLString: String?, previousAvatarURLString: String?,
|
avatarURLString: String?, previousAvatarURLString: String?,
|
||||||
member: String, memberIsYou: Bool) -> String? {
|
member: String, memberIsYou: Bool) -> String? {
|
||||||
@@ -122,7 +121,6 @@ struct RoomStateEventStringBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
||||||
func buildString(for state: OtherState, stateKey: String?, sender: TimelineItemSender, isOutgoing: Bool) -> String? {
|
func buildString(for state: OtherState, stateKey: String?, sender: TimelineItemSender, isOutgoing: Bool) -> String? {
|
||||||
let senderName = sender.displayName ?? sender.id
|
let senderName = sender.displayName ?? sender.id
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
|||||||
self.stateEventStringBuilder = stateEventStringBuilder
|
self.stateEventStringBuilder = stateEventStringBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
func buildTimelineItem(for eventItemProxy: EventTimelineItemProxy) -> RoomTimelineItemProtocol? {
|
func buildTimelineItem(for eventItemProxy: EventTimelineItemProxy) -> RoomTimelineItemProtocol? {
|
||||||
let isOutgoing = eventItemProxy.isOwn
|
let isOutgoing = eventItemProxy.isOwn
|
||||||
|
|
||||||
@@ -543,7 +542,6 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
|||||||
|
|
||||||
// MARK: - Reply details
|
// MARK: - Reply details
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
private func buildReplyToDetailsFrom(details: InReplyToDetails?) -> TimelineItemReplyDetails? {
|
private func buildReplyToDetailsFrom(details: InReplyToDetails?) -> TimelineItemReplyDetails? {
|
||||||
guard let details else { return nil }
|
guard let details else { return nil }
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ enum RoomTimelineItemType: Equatable {
|
|||||||
case location(LocationRoomTimelineItem)
|
case location(LocationRoomTimelineItem)
|
||||||
case poll(PollRoomTimelineItem)
|
case poll(PollRoomTimelineItem)
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity
|
|
||||||
init(item: RoomTimelineItemProtocol) {
|
init(item: RoomTimelineItemProtocol) {
|
||||||
switch item {
|
switch item {
|
||||||
case let item as TextRoomTimelineItem:
|
case let item as TextRoomTimelineItem:
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ class LoggingTests: XCTestCase {
|
|||||||
XCTAssertFalse(content.contains(lastMessage))
|
XCTAssertFalse(content.contains(lastMessage))
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next function_body_length
|
|
||||||
func testTimelineContentIsRedacted() throws {
|
func testTimelineContentIsRedacted() throws {
|
||||||
// Given timeline items that contain text
|
// Given timeline items that contain text
|
||||||
let textAttributedString = "TextAttributed"
|
let textAttributedString = "TextAttributed"
|
||||||
|
|||||||
Reference in New Issue
Block a user