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