diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4d7b1292b..ba34de7e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,7 @@ jobs: with: filters: | macos: + - '.swiftlint.yml' - 'macos/**' required: @@ -963,7 +964,7 @@ jobs: useDaemon: false # sometimes fails on short jobs - name: swiftlint check - run: nix develop -c swiftlint lint --strict macos + run: nix develop -c swiftlint lint --strict alejandra: if: github.repository == 'ghostty-org/ghostty' diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 000000000..7f1b56883 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,2 @@ +included: macos +child_config: macos/.swiftlint.yml diff --git a/AGENTS.md b/AGENTS.md index 949bf588e..21645e4d2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ A file for [guiding coding agents](https://agents.md/). - **Test (Zig):** `zig build test` - **Test filter (Zig)**: `zig build test -Dtest-filter=` - **Formatting (Zig)**: `zig fmt .` -- **Formatting (Swift)**: `swiftlint lint --fix macos` +- **Formatting (Swift)**: `swiftlint lint --fix` - **Formatting (other)**: `prettier -w .` ## Directory Structure diff --git a/CODEOWNERS b/CODEOWNERS index 7e471d1b8..23c95583c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -137,6 +137,7 @@ /dist/macos/ @ghostty-org/macos /pkg/apple-sdk/ @ghostty-org/macos /pkg/macos/ @ghostty-org/macos +/.swiftlint.yml @ghostty-org/macos # Renderer /src/renderer.zig @ghostty-org/renderer diff --git a/HACKING.md b/HACKING.md index 23657cea5..7ba584881 100644 --- a/HACKING.md +++ b/HACKING.md @@ -194,7 +194,7 @@ are modifying Swift code, you may want to install it locally and run this from the repo root before you commit: ``` -swiftlint lint --fix macos +swiftlint lint --fix ``` Make sure your SwiftLint version matches the version in [devShell.nix](https://github.com/ghostty-org/ghostty/blob/main/nix/devShell.nix). @@ -202,13 +202,13 @@ Make sure your SwiftLint version matches the version in [devShell.nix](https://g Nix users can use the following command to format with SwiftLint: ``` -nix develop -c swiftlint lint --fix macos +nix develop -c swiftlint lint --fix ``` To check for violations without auto-fixing: ``` -nix develop -c swiftlint lint --strict macos +nix develop -c swiftlint lint --strict ``` ### Updating the Zig Cache Fixed-Output Derivation Hash diff --git a/macos/.swiftlint.yml b/macos/.swiftlint.yml index 8f76034af..a3bd7fc22 100644 --- a/macos/.swiftlint.yml +++ b/macos/.swiftlint.yml @@ -2,6 +2,9 @@ # check_for_updates: false +excluded: + - build + disabled_rules: - cyclomatic_complexity - file_length @@ -13,7 +16,6 @@ disabled_rules: - type_body_length # TODO - - deployment_target - for_where - force_cast - line_length diff --git a/macos/Ghostty.xcodeproj/project.pbxproj b/macos/Ghostty.xcodeproj/project.pbxproj index e69331367..49d8132e8 100644 --- a/macos/Ghostty.xcodeproj/project.pbxproj +++ b/macos/Ghostty.xcodeproj/project.pbxproj @@ -509,7 +509,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "[[ -z \"$GITHUB_ACTIONS\" ]] || exit 0;\n\nSWIFTLINT=\"\"\nif command -v swiftlint >/dev/null 2>&1; then\n SWIFTLINT=\"$(command -v swiftlint)\"\nelif [[ -f \"/opt/homebrew/bin/swiftlint\" ]]; then\n SWIFTLINT=\"/opt/homebrew/bin/swiftlint\"\nfi\n\nif [[ -n \"$SWIFTLINT\" ]]; then\n \"$SWIFTLINT\" lint --quiet \"$SRCROOT\"\nfi\n"; + shellScript = "[[ -z \"$GITHUB_ACTIONS\" ]] || exit 0;\n\nSWIFTLINT=\"\"\nif command -v swiftlint >/dev/null 2>&1; then\n SWIFTLINT=\"$(command -v swiftlint)\"\nelif [[ -f \"/opt/homebrew/bin/swiftlint\" ]]; then\n SWIFTLINT=\"/opt/homebrew/bin/swiftlint\"\nfi\n\nif [[ -n \"$SWIFTLINT\" ]]; then\n \"$SWIFTLINT\" lint --quiet\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */