Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Analyze] Support compile commands with relative paths #3501

Merged
merged 2 commits into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

#### Enhancements

* None.
* Support relative paths in compilation databases for SwiftLint analyzer
rules.
[JP Simard](https://github.com/jpsim)

#### Bug Fixes

* Fix `custom_rules` merging when the parent configuration is based on `only_rules`.
* Fix `custom_rules` merging when the parent configuration is based on
`only_rules`.
[Frederick Pietschmann](https://github.com/fredpi)
[#3468](https://github.com/realm/SwiftLint/issues/3468)

Expand All @@ -34,7 +37,8 @@
[Frederick Pietschmann](https://github.com/fredpi)
[#3472](https://github.com/realm/SwiftLint/issues/3472)

* Fix bug that prevented the reconfiguration of a custom rule in a child config.
* Fix bug that prevented the reconfiguration of a custom rule in a child
config.
[Frederick Pietschmann](https://github.com/fredpi)
[#3477](https://github.com/realm/SwiftLint/issues/3477)

Expand Down
3 changes: 2 additions & 1 deletion Source/swiftlint/Helpers/LintableFilesVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ enum CompilerInvocations {
return CompilerArgumentsExtractor
.compilerArgumentsForFile(path, compilerInvocations: compilerInvocations)
case let .compilationDatabase(compileCommands):
return compileCommands[path]
return compileCommands[path] ??
compileCommands[path.path(relativeTo: FileManager.default.currentDirectoryPath)]
}
} ?? []
}
Expand Down