Skip to content

make lint passes on main, and CI runs it on every pull request - #780

Open
isaaclins wants to merge 3 commits into
mainfrom
fix/365-lint-clean
Open

isaaclins wants to merge 3 commits into
mainfrom
fix/365-lint-clean

Conversation

@isaaclins

Copy link
Copy Markdown
Owner

Fixes #365

make lint passes on this branch, and CI gets a Format check job that runs it on every pull request and push to main, so a new violation fails the build.

Nothing visible changes, so there are no screenshots. The one difference a listener could notice: when Apple Music playback hits a network error, the message is now my own sentence in the app's language ("Couldn't reach Apple Music. Check your connection, then try again.") instead of the system's raw error text. Spotify already worked that way.

What's in it

Three commits, kept apart so each one can be checked on its own:

  1. Reformat (c5f393c7): only the output of make format over Spotiglass/ and SpotiglassTests/ with the existing .swift-format. Nothing else is in this commit, so running make format on its parent gives the same tree.
  2. What the formatter can't fix by itself (7e244d27):
    • 29 forEach { } closures become for … in loops
    • 9 calls that mixed closure arguments with a trailing closure now pass every closure by label
    • the XCTAssertThrowsEditError test helper is now assertThrowsEditError
    • The reformat moved the line text of 18 sites the error-handling audit tracks, so it read them as new. Re-listing them would grow the baseline, which CI forbids, so I fixed them instead. The try? sites now say why losing the error is fine, the catches that kept quiet now log what failed, and the MusicKit network error above now uses my own sentence. The baseline only shrinks (81 lines removed).
  3. CI and tooling (2b9f64bb): scripts/swift-format.sh lint|format is what make lint, make format and the new CI job all run. The job runs on Linux in swift:6.4.3-noble, pinned by digest, so its verdict doesn't drift with whatever Xcode a runner has. CONTRIBUTING.md, docs/building-and-testing.md and docs/ci-and-releases.md say how it works.

How I checked it

  • make lint: 0 findings, down from about 10,000 on main. The pinned CI image (swift-format 6.4.3) and my local Xcode 27.2 copy (6.4.4) give the same verdict on this tree.
  • I added a badly formatted line on purpose and scripts/swift-format.sh lint exited with code 123 and named the line, then passed again once I removed it.
  • scripts/audit-error-handling.sh --no-growth-from origin/main: OK
  • make build: passes. make test: 2,743 tests, 0 failures, 1 skipped.
  • scripts/check-periphery.sh (2.21.2): only SpotiglassSettingsView.columnVisibility, which my Mac's newer Xcode reports on main too and CI's scan doesn't.
  • Speed: no interaction changes, so there's nothing to time. The edits are formatting, log lines and comments.

What I could not check

  • The new job runs for the first time on this PR. If the runner can't pull the image, that check shows up red here, before anything merges.
  • I only read through the reformat. Builds and tests show it compiles and behaves the same. I didn't open every one of its 395 files in the app.

Rebasing

Every merge into main that touches Swift will conflict with commit 1. The cheapest way through is to never resolve those conflicts by hand:

git checkout -B fix/365-lint-clean origin/main
make format && git add Spotiglass SpotiglassTests && git commit -m "Reformat Spotiglass and SpotiglassTests with swift-format"
git cherry-pick <commit 2> <commit 3>   # small, and the conflicts are local
make lint && scripts/audit-error-handling.sh --update-baseline

Once this merges, any open PR that conflicts can take main's side of the Swift files, apply its own change again, and run make format.

The output of make format with the repo's .swift-format rules and nothing
else, so it can be reproduced and reviewed as a whole. Part of #365.
swift-format can't fix these by itself: forEach closures become for-in loops,
calls that mixed closure arguments with a trailing closure pass them all by
label, and the XCTAssertThrowsEditError test helper is now
assertThrowsEditError.

The reformat also moved the line text of 18 sites the error-handling audit
tracks, so they read as new ones. Instead of re-listing them, each is fixed:
the try? sites say why losing the error is fine, the catches that kept quiet
log what failed, and a MusicKit network error shows the app's own sentence
instead of the system's. The baseline only shrinks.

Part of #365.
make format, make lint and the new CI format check share
scripts/swift-format.sh. The check runs on Linux in the Swift 6.4.3 image,
pinned by digest, so its verdict doesn't move with the runner's toolchain.

Fixes #365.
@isaaclins isaaclins added bug Something isn't working priority:medium Fix when convenient labels Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority:medium Fix when convenient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make lint fails on a clean checkout of main with 5243 errors, and CI never runs it

1 participant