1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

👌 Fixed various lint issues

This commit is contained in:
2023-11-21 18:19:17 +01:00
parent 1f19b81530
commit 3b78ac43d7
10 changed files with 15 additions and 15 deletions

View File

@ -103,6 +103,7 @@ public struct TestableConfiguration: Codable {
)
}
}
// swiftlint:enable function_body_length
// MARK: Interactions

View File

@ -11,7 +11,7 @@ import Foundation
class BrewTapFormulae {
public static func from(tap: String) -> [String: Set<String>] {
let directory = "\(Paths.tapPath)/\(tap)/Formula"
let files = try? FileSystem.getShallowContentsOfDirectory(directory)
var availableExtensions = [String: Set<String>]()

View File

@ -287,7 +287,7 @@ extension MainMenu {
PhpEnvironments.shared.delegate = self
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
updatePhpVersionInStatusBar()
refreshIcon()
rebuild()
await PhpEnvironments.switcher.performSwitch(to: version)
@ -302,7 +302,7 @@ extension MainMenu {
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
Task(priority: .userInitiated) { [unowned self] in
updatePhpVersionInStatusBar()
refreshIcon()
rebuild()
await PhpEnvironments.switcher.performSwitch(to: version)
@ -328,7 +328,7 @@ extension MainMenu {
PhpEnvironments.shared.delegate?.switcherDidStartSwitching(to: version)
}
updatePhpVersionInStatusBar()
refreshIcon()
rebuild()
await PhpEnvironments.switcher.performSwitch(to: version)

View File

@ -63,7 +63,8 @@ extension MainMenu {
}
if behaviours.contains(.updatesMenuBarContents) {
updatePhpVersionInStatusBar()
refreshIcon()
rebuild()
}
if behaviours.contains(.broadcastServicesUpdate) {

View File

@ -63,9 +63,6 @@ extension MainMenu {
// Check for an alias conflict
await BrewDiagnostics.checkForCaskConflict()
// Update the icon
updatePhpVersionInStatusBar()
// Attempt to find out if PHP-FPM is broken
PhpEnvironments.prepare()
@ -129,6 +126,7 @@ extension MainMenu {
PhpGuard().compareToLastGlobalVersion()
// We are ready!
PhpEnvironments.shared.isBusy = false
Log.info("PHP Monitor is ready to serve!")
// Check if we upgraded just now

View File

@ -27,7 +27,7 @@ extension MainMenu {
// Perform UI updates on main thread
Task { @MainActor [self] in
updatePhpVersionInStatusBar()
refreshIcon()
rebuild()
if Valet.installed && !PhpEnvironments.shared.validate(version) {

View File

@ -37,8 +37,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
// MARK: - UI related
/**
Rebuilds the menu (either asynchronously or synchronously).
Defaults to rebuilding the menu asynchronously.
Rebuilds the menu on the main thread.
*/
func rebuild() {
Task { @MainActor [self] in
@ -80,7 +79,8 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate, PhpSwitcherDelegate
@objc func refreshActiveInstallation() {
if !PhpEnvironments.shared.isBusy {
PhpEnvironments.shared.currentInstall = ActivePhpInstallation.load()
updatePhpVersionInStatusBar()
refreshIcon()
rebuild()
} else {
Log.perf("Skipping version refresh due to busy status!")
}

View File

@ -91,7 +91,7 @@ class BetterAlert {
}
NSApp.activate(ignoringOtherApps: true)
windowController.window?.makeKeyAndOrderFront(nil)
windowController.window?.setCenterPosition(offsetY: 70)
return NSApplication.shared.runModal(for: windowController.window!)

View File

@ -56,7 +56,6 @@ class ConfigFSNotifier {
return App.shared.handlePhpConfigWatcher(forceReload: true)
}
self?.parent.didChange?(self!.url)
}

View File

@ -8,8 +8,8 @@
import Foundation
// swiftlint:disable function_body_length
class FakeBrewFormulaeHandler: HandlesBrewPhpFormulae {
// swiftlint:disable function_body_length
public func loadPhpVersions(loadOutdated: Bool) async -> [BrewPhpFormula] {
return [
BrewPhpFormula(
@ -78,3 +78,4 @@ class FakeBrewFormulaeHandler: HandlesBrewPhpFormulae {
]
}
}
// swiftlint:enable function_body_length