Skip to content

Commit

Permalink
[Analyze] Support compile commands with relative paths (realm#3501)
Browse files Browse the repository at this point in the history
* [Analyze] Support compile commands with relative paths

* Add changelog entry

And made small formatting edits to other recent entries.
  • Loading branch information
jpsim authored Jan 22, 2021
1 parent 537e53f commit 6de5771
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
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

0 comments on commit 6de5771

Please sign in to comment.