mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
fix linting directories ending in .swift
This commit is contained in:
@@ -124,6 +124,9 @@
|
||||
* Fix `variable_name` and `type_name` rules on Linux.
|
||||
[Marcelo Fabri](https://github.com/marcelofabri)
|
||||
|
||||
* Fix linting directories with names ending with `.swift`.
|
||||
[JP Simard](https://github.com/jpsim)
|
||||
|
||||
## 0.15.0: Hand Washable Holiday Linens 🎄
|
||||
|
||||
##### Breaking
|
||||
|
||||
@@ -9,6 +9,20 @@
|
||||
import Foundation
|
||||
import SourceKittenFramework
|
||||
|
||||
extension String {
|
||||
fileprivate var isFile: Bool {
|
||||
var isDirectoryObjC: ObjCBool = false
|
||||
if FileManager.default.fileExists(atPath: self, isDirectory: &isDirectoryObjC) {
|
||||
#if os(Linux)
|
||||
return !isDirectoryObjC
|
||||
#else
|
||||
return !isDirectoryObjC.boolValue
|
||||
#endif
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private let fileManager = FileManager.default
|
||||
|
||||
private enum ConfigurationKey: String {
|
||||
@@ -170,7 +184,7 @@ public struct Configuration: Equatable {
|
||||
public func lintablePathsForPath(_ path: String,
|
||||
fileManager: LintableFileManager = fileManager) -> [String] {
|
||||
// If path is a Swift file, skip filtering with excluded/included paths
|
||||
if path.bridge().isSwiftFile() {
|
||||
if path.bridge().isSwiftFile() && path.isFile {
|
||||
return [path]
|
||||
}
|
||||
let pathsForPath = included.isEmpty ? fileManager.filesToLintAtPath(path, rootDirectory: nil) : []
|
||||
|
||||
Reference in New Issue
Block a user