macos: swiftlint 'colon' rule

This commit is contained in:
Jon Parise
2026-02-19 18:32:44 -05:00
parent 4289c1d637
commit 786bad9774
11 changed files with 21 additions and 22 deletions

View File

@@ -13,7 +13,6 @@ disabled_rules:
- type_body_length
# TODO
- colon
- comma
- comment_spacing
- control_statement

View File

@@ -309,7 +309,7 @@ enum KeyEventMods: String, AppEnum, CaseIterable {
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Modifier Key")
static var caseDisplayRepresentations: [KeyEventMods : DisplayRepresentation] = [
static var caseDisplayRepresentations: [KeyEventMods: DisplayRepresentation] = [
.shift: "Shift",
.control: "Control",
.option: "Option",

View File

@@ -7,7 +7,7 @@ protocol ClipboardConfirmationViewDelegate: AnyObject {
/// The SwiftUI view for showing a clipboard confirmation dialog.
struct ClipboardConfirmationView: View {
enum Action : String {
enum Action: String {
case cancel
case confirm

View File

@@ -1,6 +1,6 @@
import Cocoa
enum QuickTerminalPosition : String {
enum QuickTerminalPosition: String {
case top
case bottom
case left
@@ -86,7 +86,7 @@ enum QuickTerminalPosition : String {
y: round(screen.visibleFrame.origin.y + (screen.visibleFrame.height - window.frame.height) / 2))
case .center:
return .init(x: round(screen.visibleFrame.origin.x + (screen.visibleFrame.width - window.frame.width) / 2), y: screen.visibleFrame.height - window.frame.width)
return .init(x: round(screen.visibleFrame.origin.x + (screen.visibleFrame.width - window.frame.width) / 2), y: screen.visibleFrame.height - window.frame.width)
}
}

View File

@@ -12,7 +12,7 @@ import OSLog
// it. You have to yield secure input on application deactivation (because
// it'll affect other apps) and reacquire on reactivation, and every enable
// needs to be balanced with a disable.
class SecureInput : ObservableObject {
class SecureInput: ObservableObject {
static let shared = SecureInput()
private static let logger = Logger(

View File

@@ -347,7 +347,7 @@ class TerminalWindow: NSWindow {
button.toolTip = "Reset Zoom"
button.contentTintColor = isMainWindow ? .controlAccentColor : .secondaryLabelColor
button.state = .on
button.image = NSImage(named:"ResetZoom")
button.image = NSImage(named: "ResetZoom")
button.frame = NSRect(x: 0, y: 0, width: 20, height: 20)
button.translatesAutoresizingMaskIntoConstraints = false
button.widthAnchor.constraint(equalToConstant: 20).isActive = true

View File

@@ -251,7 +251,7 @@ class TitlebarTabsVenturaTerminalWindow: TerminalWindow {
button.toolTip = "Reset Zoom"
button.contentTintColor = .controlAccentColor
button.state = .on
button.image = NSImage(named:"ResetZoom")
button.image = NSImage(named: "ResetZoom")
button.frame = NSRect(x: 0, y: 0, width: 20, height: 20)
button.translatesAutoresizingMaskIntoConstraints = false
button.widthAnchor.constraint(equalToConstant: 20).isActive = true

View File

@@ -416,7 +416,7 @@ extension Ghostty {
return MacHidden(rawValue: str) ?? .never
}
var focusFollowsMouse : Bool {
var focusFollowsMouse: Bool {
guard let config = self.config else { return false }
var v = false;
let key = "focus-follows-mouse"
@@ -680,7 +680,7 @@ extension Ghostty {
// MARK: Configuration Enums
extension Ghostty.Config {
enum AutoUpdate : String {
enum AutoUpdate: String {
case off
case check
case download
@@ -769,7 +769,7 @@ extension Ghostty.Config {
case new_window = "new-window"
}
enum MacHidden : String {
enum MacHidden: String {
case never
case always
}
@@ -785,13 +785,13 @@ extension Ghostty.Config {
case never
}
enum ResizeOverlay : String {
enum ResizeOverlay: String {
case always
case never
case after_first = "after-first"
}
enum ResizeOverlayPosition : String {
enum ResizeOverlayPosition: String {
case center
case top_left = "top-left"
case top_center = "top-center"

View File

@@ -81,7 +81,7 @@ extension Ghostty {
/// A map from the Ghostty key enum to the keyEquivalent string for shortcuts. Note that
/// not all ghostty key enum values are represented here because not all of them can be
/// mapped to a KeyEquivalent.
static let keyToEquivalent: [ghostty_input_key_e : KeyEquivalent] = [
static let keyToEquivalent: [ghostty_input_key_e: KeyEquivalent] = [
// Function keys
GHOSTTY_KEY_ARROW_UP: .upArrow,
GHOSTTY_KEY_ARROW_DOWN: .downArrow,
@@ -243,7 +243,7 @@ extension Ghostty.Input {
extension Ghostty.Input.Action: AppEnum {
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Key Action")
static var caseDisplayRepresentations: [Ghostty.Input.Action : DisplayRepresentation] = [
static var caseDisplayRepresentations: [Ghostty.Input.Action: DisplayRepresentation] = [
.release: "Release",
.press: "Press",
.repeat: "Repeat"
@@ -355,7 +355,7 @@ extension Ghostty.Input {
extension Ghostty.Input.MouseState: AppEnum {
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Mouse State")
static var caseDisplayRepresentations: [Ghostty.Input.MouseState : DisplayRepresentation] = [
static var caseDisplayRepresentations: [Ghostty.Input.MouseState: DisplayRepresentation] = [
.release: "Release",
.press: "Press"
]
@@ -420,7 +420,7 @@ extension Ghostty.Input {
extension Ghostty.Input.MouseButton: AppEnum {
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Mouse Button")
static var caseDisplayRepresentations: [Ghostty.Input.MouseButton : DisplayRepresentation] = [
static var caseDisplayRepresentations: [Ghostty.Input.MouseButton: DisplayRepresentation] = [
.unknown: "Unknown",
.left: "Left",
.right: "Right",
@@ -504,7 +504,7 @@ extension Ghostty.Input {
extension Ghostty.Input.Momentum: AppEnum {
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Scroll Momentum")
static var caseDisplayRepresentations: [Ghostty.Input.Momentum : DisplayRepresentation] = [
static var caseDisplayRepresentations: [Ghostty.Input.Momentum: DisplayRepresentation] = [
.none: "None",
.began: "Began",
.stationary: "Stationary",
@@ -1223,7 +1223,7 @@ extension Ghostty.Input.Key: AppEnum {
]
}
static var caseDisplayRepresentations: [Ghostty.Input.Key : DisplayRepresentation] = [
static var caseDisplayRepresentations: [Ghostty.Input.Key: DisplayRepresentation] = [
// Letters (A-Z)
.a: "A", .b: "B", .c: "C", .d: "D", .e: "E", .f: "F", .g: "G", .h: "H", .i: "I", .j: "J",
.k: "K", .l: "L", .m: "M", .n: "N", .o: "O", .p: "P", .q: "Q", .r: "R", .s: "S", .t: "T",

View File

@@ -498,4 +498,4 @@ extension Ghostty.Notification {
}
// Make the input enum hashable.
extension ghostty_input_key_e : @retroactive Hashable {}
extension ghostty_input_key_e: @retroactive Hashable {}

View File

@@ -1389,7 +1389,7 @@ extension Ghostty {
// since we always have a primary font. The only scenario this doesn't
// work is if someone is using a non-CoreText build which would be
// unofficial.
var attributes: [ NSAttributedString.Key : Any ] = [:];
var attributes: [ NSAttributedString.Key: Any ] = [:];
if let fontRaw = ghostty_surface_quicklook_font(surface) {
// Memory management here is wonky: ghostty_surface_quicklook_font
// will create a copy of a CTFont, Swift will auto-retain the
@@ -1831,7 +1831,7 @@ extension Ghostty.SurfaceView: NSTextInputClient {
// since we always have a primary font. The only scenario this doesn't
// work is if someone is using a non-CoreText build which would be
// unofficial.
var attributes: [ NSAttributedString.Key : Any ] = [:];
var attributes: [ NSAttributedString.Key: Any ] = [:];
if let fontRaw = ghostty_surface_quicklook_font(surface) {
// Memory management here is wonky: ghostty_surface_quicklook_font
// will create a copy of a CTFont, Swift will auto-retain the