Skip to content

Fix --working-directory having no effect - #6908

Open
haruna-miyamoto wants to merge 2 commits into
realm:mainfrom
haruna-miyamoto:fix/working-directory-defer-scope
Open

haruna-miyamoto wants to merge 2 commits into
realm:mainfrom
haruna-miyamoto:fix/working-directory-defer-scope

Conversation

@haruna-miyamoto

Copy link
Copy Markdown

Fixes #6907.

The defer restoring the previous directory was scoped to the
`if let workingDirectory` block, so it ran at that block's closing brace,
before linting started. Move it to the function's scope and restore only
when the option actually moved the directory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@SwiftLintBot

SwiftLintBot commented Sep 14, 2026 •

Copy link
Copy Markdown
1 Error
🚫 Please rebase to get rid of the merge commits in this PR
20 Messages
📖 Building this branch resulted in the same binary size as when built on main.
📖 Linting Aerial with this PR took 0.68 s vs 0.68 s on main (0% slower).
📖 Linting Alamofire with this PR took 0.97 s vs 0.98 s on main (1% faster).
📖 Linting Brave with this PR took 5.5 s vs 5.52 s on main (0% faster).
📖 Linting Brigade with this PR took 18.37 s vs 18.3 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 31.72 s vs 31.6 s on main (0% slower).
📖 Linting Firefox with this PR took 11.67 s vs 11.68 s on main (0% faster).
📖 Linting Kickstarter with this PR took 7.37 s vs 7.41 s on main (0% faster).
📖 Linting Moya with this PR took 0.38 s vs 0.38 s on main (0% slower).
📖 Linting NetNewsWire with this PR took 2.56 s vs 2.59 s on main (1% faster).
📖 Linting Nimble with this PR took 0.55 s vs 0.56 s on main (1% faster).
📖 Linting PocketCasts with this PR took 7.43 s vs 7.41 s on main (0% slower).
📖 Linting Quick with this PR took 0.36 s vs 0.36 s on main (0% slower).
📖 Linting Realm with this PR took 3.0 s vs 2.96 s on main (1% slower).
📖 Linting Sourcery with this PR took 1.64 s vs 1.62 s on main (1% slower).
📖 Linting Swift with this PR took 4.54 s vs 4.53 s on main (0% slower).
📖 Linting SwiftLintPerformanceTests with this PR took 0.18 s vs 0.18 s on main (0% slower).
📖 Linting VLC with this PR took 1.45 s vs 1.45 s on main (0% slower).
📖 Linting Wire with this PR took 16.41 s vs 16.39 s on main (0% slower).
📖 Linting WordPress with this PR took 10.64 s vs 10.63 s on main (0% slower).

Generated by 🚫 Danger

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--working-directory has no effect since 0.65.0

2 participants