Repository navigation
Fix baseline matching for violations under /private paths - #8
Merged
Merged
Conversation
When a project lives under a firmlink (e.g. a mktemp -d directory or a CI workspace under /private/var/folders) and the config has a non-empty excluded: list, FileManager's enumerator yields /private-prefixed paths while paths read back from a baseline are standardized without the prefix. relativeDisplayPath now normalizes the prefix on both sides before the replacement so the write-time and read-time keys agree. Fixes realm#6909
Owner
Author
|
Re-triggering fork CI (Actions were enabled after this PR was created). |
olitreadwell
added a commit
that referenced
this pull request
Sep 25, 2026
- Refresh header: upstream still main @ d515610 - Gap ledger: 2026-09-25 issue realm#6909 baseline matching under /private paths, fork PR #8 - Move misplaced 2026-09-24 typo PR #7 entry from Mined gaps to Gap ledger
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.
What changed
relativeDisplayPathnow normalizes the/privateprefix on the working directory path and on the file path before subtracting one from the other.When a project lives under a firmlink (
mktemp -d,/tmp, a CI workspace under/private/var/folders) and the config has a non-emptyexcluded:list, the directory enumerator reports/private-prefixed paths while paths read back from a written baseline are standardized without the prefix.The two sides disagree, so the baseline key lookup misses and every baselined violation resurfaces.
This bridges the same
/privategap the exclusion matcher already handles inExcluder.Why
Fixes realm#6909.
Reproduced on
mainatd5156105b.With an
excluded:entry under/private, the one-file repro exits 2 before this change and 0 after.The same config under
/Users, and the no-excluded:case, already worked.How to verify
git fetch https://github.com/olitreadwell/SwiftLint.git fix-baseline-private-paths git checkout FETCH_HEAD swift testManual repro (matches the issue):
Expected: no violations, exit 0.
SwiftLint's substantive CI runs on Azure Pipelines and Buildkite, which are not connected to this fork.
On the fork, the GitHub Actions
Lint,Build, andTestworkflows all pass. TheDocumentationjob fails only at itssourcekitten doc --spminfrastructure step (SPM build manifest does not exist at .../.build/debug.yaml); this is unrelated to this change — the docs job invokes a plainswift buildmanifest that the Bazel-based runner doesn't populate, and the added code exposes no new public API.Verified locally here:
swift buildsucceeds, the repro and its controls exit 0, and the changed files passswiftlint lint.The added unit test (
BaselineTests.filteredAcrossPrivatePrefix) is exercised byswift test.PROMOTION NOTE (remove this section before/when opening against upstream):