Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepistrol committed Oct 4, 2024
1 parent 9619f0d commit a4a4e33
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 13 deletions.
2 changes: 1 addition & 1 deletion TimeMachineStatus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nif [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which swiftlint > /dev/null; then\n if $CI; then\n echo \"Skipping SwiftLint (CI)\"\n else\n swiftlint\n fi\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nif [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\nif which swiftlint > /dev/null; then\n if [[ $CI ]]; then\n echo \"Skipping SwiftLint (CI)\"\n else\n swiftlint\n fi\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "28A002162AFBBFC300E2A01E"
BuildableName = "TimeMachineStatus.app"
BlueprintName = "TimeMachineStatus"
ReferencedContainer = "container:TimeMachineStatus.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "28A002162AFBBFC300E2A01E"
BuildableName = "TimeMachineStatus.app"
BlueprintName = "TimeMachineStatus"
ReferencedContainer = "container:TimeMachineStatus.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "28A002162AFBBFC300E2A01E"
BuildableName = "TimeMachineStatus.app"
BlueprintName = "TimeMachineStatus"
ReferencedContainer = "container:TimeMachineStatus.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion TimeMachineStatus/Components/ExpandableSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct ExpandableSection<C: View, H: View>: View {
HStack {
header()
Spacer()
Image(systemName: "chevron.right")
Image(systemSymbol: .chevronRight)
.rotationEffect(expanded ? .degrees(90) : .zero)
.padding(.horizontal, 12)
.contentShape(.rect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

import SwiftUI

private struct HideWindowControllsViewModifier: ViewModifier {
private struct HideWindowControlsViewModifier: ViewModifier {

let types: [NSWindow.ButtonType]

func body(content: Content) -> some View {
content
.onReceive(NotificationCenter.default.publisher(for: NSWindow.didBecomeKeyNotification)) { notification in
.onReceive(NotificationCenter.default.publisher(for: NSWindow.didBecomeKeyNotification)) { _ in
guard let window = NSApplication.shared.windows.first(where: { $0.isKeyWindow }) else { return }
hideWindowControls(for: window)
}
Expand All @@ -38,6 +38,6 @@ extension View {
.zoomButton
]
) -> some View {
modifier(HideWindowControllsViewModifier(types: types))
modifier(HideWindowControlsViewModifier(types: types))
}
}
2 changes: 1 addition & 1 deletion TimeMachineStatus/Components/UserfacingErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct UserfacingErrorView: View {
if let action = error.action {
Divider()
switch action {
case .link(let title, let url):
case let .link(title, url):
Button(title) {
NSWorkspace.shared.open(url)
}
Expand Down
8 changes: 4 additions & 4 deletions TimeMachineStatus/Model/Preferences/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct Preferences: Decodable {
)
self.destinations = try container
.decodeIfPresent([Destination].self, forKey: .destinations)?
.sorted {$0.lastKnownVolumeName ?? "" < $1.lastKnownVolumeName ?? "" }
.sorted { $0.lastKnownVolumeName ?? "" < $1.lastKnownVolumeName ?? "" }
self.skipPaths = try container.decodeIfPresent([String].self, forKey: .skipPaths)
}

Expand Down Expand Up @@ -144,13 +144,13 @@ extension Destination {
bytesAvailable: .random(in: 10_000_000_000...100_000_000_000),
filesystemTypeName: "APFS",
lastKnownEncryptionState: "Encrypted",
quotaGB: .random(in: 400...1000),
quotaGB: .random(in: 400...1_000),
networkURL: network ? "smb://nas.local/share" : nil,
destinationID: UUID(),
consistencyScanDate: .distantPast,
referenceLocalSnapshotDate: .now,
snapshotDates: [.distantPast, .now.addingTimeInterval(.random(in: -100000...0))],
attemptDates: [.distantPast, .now.addingTimeInterval(.random(in: -100000...0))]
snapshotDates: [.distantPast, .now.addingTimeInterval(.random(in: -100_000...0))],
attemptDates: [.distantPast, .now.addingTimeInterval(.random(in: -100_000...0))]
)
}
}
2 changes: 1 addition & 1 deletion TimeMachineStatus/TimeMachineStatusApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import Logging
import LoggingOSLog
import SwiftUI
@_exported import SFSafeSymbols
import SwiftUI

@main
struct TimeMachineStatusApp: App {
Expand Down
2 changes: 1 addition & 1 deletion TimeMachineStatus/ViewModel/TMUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class TMUtilityImpl: TMUtility {

var canReadPreferences: Bool {
do {
let _ = try Data(contentsOf: Constants.URLs.timeMachinePreferencesPlist)
_ = try Data(contentsOf: Constants.URLs.timeMachinePreferencesPlist)
return true
} catch {
return false
Expand Down
6 changes: 5 additions & 1 deletion TimeMachineStatus/Views/MenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ struct MenuView: View {

#Preview("Light Error") {
MenuView(
utility: TMUtilityMock(preferences: .mock, error: .preferencesFilePermissionNotGranted, canReadPreferences: false),
utility: TMUtilityMock(
preferences: .mock,
error: .preferencesFilePermissionNotGranted,
canReadPreferences: false
),
updater: SPUStandardUpdaterController(updaterDelegate: nil, userDriverDelegate: nil).updater
)
.preferredColorScheme(.light)
Expand Down

0 comments on commit a4a4e33

Please sign in to comment.