@@ -22,27 +22,31 @@ public final class Module {
2222 let fileManager = FileManager . default
2323 for path in paths {
2424 let directory = URL ( fileURLWithPath: path)
25- guard let directoryEnumerator = fileManager. enumerator ( at: directory, includingPropertiesForKeys: [ . isDirectoryKey] , options: [ . skipsHiddenFiles, . skipsPackageDescendants] ) else { continue }
25+ guard let directoryEnumerator = fileManager. enumerator ( at: directory,
26+ includingPropertiesForKeys: [ . isDirectoryKey] ,
27+ options: [ . skipsHiddenFiles, . skipsPackageDescendants] )
28+ else { continue }
29+
30+ let ignoredDirectories : Set < URL > = Set ( [
31+ " node_modules " ,
32+ " Packages " ,
33+ " Pods " ,
34+ " Resources " ,
35+ " Tests "
36+ ] . map { directory. appendingPathComponent ( $0) } )
37+
2638 for case let url as URL in directoryEnumerator {
27- var isDirectory : ObjCBool = false
2839 guard url. pathExtension == " swift " ,
29- fileManager. isReadableFile ( atPath: url. path) ,
30- fileManager. fileExists ( atPath: url. path, isDirectory: & isDirectory)
40+ fileManager. isReadableFile ( atPath: url. path)
3141 else {
32- // Skip top-level Tests directory
33- if isDirectory. boolValue == true ,
34- url. lastPathComponent == " Tests " ,
35- directory. appendingPathComponent ( " Tests " ) . path == url. path
36- {
42+ if ignoredDirectories. contains ( url) {
3743 directoryEnumerator. skipDescendants ( )
3844 }
3945
4046 continue
4147 }
4248
43- if isDirectory. boolValue == false {
44- sources. append ( ( url, directory) )
45- }
49+ sources. append ( ( url, directory) )
4650 }
4751 }
4852
0 commit comments