Make forceExclude work with directly specified files (#4609)
This commit is contained in:
parent
d76daf5f62
commit
eda0d92f44
|
@ -13,7 +13,9 @@
|
|||
|
||||
#### Enhancements
|
||||
|
||||
* None.
|
||||
* Make forceExclude work with directly specified files.
|
||||
[jimmya](https://github.com/jimmya)
|
||||
[#issue_number](https://github.com/realm/SwiftLint/issues/4609)
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
|
|
|
@ -33,8 +33,15 @@ extension Configuration {
|
|||
excludeByPrefix: Bool = false,
|
||||
fileManager: LintableFileManager = FileManager.default
|
||||
) -> [String] {
|
||||
if path.isFile {
|
||||
if forceExclude {
|
||||
return excludeByPrefix
|
||||
? filterExcludedPathsByPrefix(in: [path.absolutePathStandardized()])
|
||||
: filterExcludedPaths(fileManager: fileManager, in: [path.absolutePathStandardized()])
|
||||
}
|
||||
// If path is a file and we're not forcing excludes, skip filtering with excluded/included paths
|
||||
if path.isFile && !forceExclude { return [path] }
|
||||
return [path]
|
||||
}
|
||||
|
||||
let pathsForPath = includedPaths.isEmpty ? fileManager.filesToLint(inPath: path, rootDirectory: nil) : []
|
||||
let includedPaths = self.includedPaths
|
||||
|
|
Loading…
Reference in New Issue