Repository navigation
Conversation
Generated by 🚫 Danger |
This branch has not been deployed
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.
Fixes #6909
On macOS, baselines stop matching entirely when the project lives under
/private(for example/private/tmp/...) and the config has a non-emptyexcluded:list. Writing a baseline and immediately linting with it still reports every baselined violation. Removingexcluded:makes the same baseline work.The root cause is a path-spelling disagreement introduced with the
URL-based locations in #6813. Baseline entries are written fromLocation.relativeDisplayPath, which keeps the/privatecwd spelling. When reading,CodableLocation.locationrebuilt the path throughString.url(), and itsstandardizedFileURLresolves the/privatesymlink away. The decoded location's relative path could then no longer strip the/privatecwd, so its key (var/folders/.../Sources/Foo.swift) never equalled the live violation's key (Sources/Foo.swift).Decoding should be the inverse of encoding, and encoding does not normalize. This resolves the stored path against the current working directory without symlink standardization, while keeping two behaviors of the old helper: the directory-hint repair for working-directory overrides that were created without one, and lexical normalization via
.standardizedso absolute paths containing.or..components still match as before. The sharedString.url()andrelativeDisplayPathhelpers are untouched, so configuration paths and reporter display are unaffected.The new
BaselineTestscases build fixtures explicitly under/private/tmpand round-trip baselines through both/privateand non-/privatespellings (including through a symlinked directory), cover unhinted cwd overrides in the existing read/write test, and cover absolute stored paths with dot components.One nearby pre-existing inconsistency is left alone: live file URLs are standardized on the no-exclusions discovery path but not on the enumerator path used with exclusions, so a baseline written before adding an
excluded:entry can store a different key form. That predates this change and seems best handled separately from this regression.