Repository navigation
Conversation
… tests Builds on #371, which added the offending path to the `containsControlCharacters` error. Interpolating the raw path meant the control character itself was invisible or destructive in the output: a bare LF split the message across lines and a bare CR overwrote the preceding text. Use the escaped `debugDescription` of the path so the rejected character is visible, hoist the `let` in the pattern to satisfy swiftformat, and add regression tests covering the primitive and the public `FileSystem` API. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supersedes #371 by @waltflanagan, keeping its commit and building on it. Thanks for the fix, Mike!
When
File.Pathrejects a path containing control characters, the error now says which path was rejected, and the path is rendered in its escaped form so the offending character is visible:Why the extra change on top of #371
#371 interpolated the raw path into the message. Because the path contains a control character by definition, the character itself was invisible or destructive in the output: a bare LF split the message across two lines, and a bare CR overwrote the text before it. Using the path's
debugDescriptionprints the escaped form instead, which is what someone debugging the error needs to see.Changes
File.Path.Error.containsControlCharacterscarries the original path string (from fix: print path triggering containsControlCharacters error #371).path.debugDescriptionso control characters are escaped.letis hoisted to satisfy the repository's swiftformat rules.FilePathErrorTestscover the associated value, the escaped description for LF, CR, NUL and TAB, and the message surfacing through the publicFileSystemAPI.Notes
File.Path.Errorstill does not conform toLocalizedError, solocalizedDescriptionreturns Foundation's generic text. This is intentional: the primitives module is Foundation-free. Neither this library nor the Tuist CLI reads errors throughlocalizedDescription; the CLI falls through toCustomStringConvertible.descriptionfor this error type, so users see the message above.Validation
swift testpasses locally on macOS.swiftformat --lintis clean on the new test file; the only remaining warning on the vendored source file is the pre-existing file-header one.🤖 Generated with Claude Code