@@ -73,7 +73,7 @@ struct SwiftDocCoverage: ParsableCommand {
7373 var skipsHiddenFiles : Bool = true
7474
7575 @Option ( name: . shortAndLong, help: " Skip source code files with file paths that match the given regular expression. " )
76- var ignoreFilenameRegex : String = " "
76+ var ignoreRegex : String = " "
7777
7878 @Option ( name: . shortAndLong, help: " The minimum access level of the symbols considered for coverage statistics: \( AccessLevel . open) , \( AccessLevel . public) , \( AccessLevel . internal) , \( AccessLevel . fileprivate) , \( AccessLevel . private) . " )
7979 var minimumAccessLevel : AccessLevel = . public
@@ -85,7 +85,7 @@ struct SwiftDocCoverage: ParsableCommand {
8585 var output : String ?
8686
8787 private enum CodingKeys : String , CodingKey {
88- case inputs, skipsHiddenFiles, ignoreFilenameRegex , minimumAccessLevel, report, output
88+ case inputs, skipsHiddenFiles, ignoreRegex , minimumAccessLevel, report, output
8989 }
9090
9191 var sources : [ SwiftSource ] = [ ]
@@ -108,7 +108,7 @@ struct SwiftDocCoverage: ParsableCommand {
108108 }
109109
110110 let urls = try inputs. flatMap {
111- try Self . files ( path: $0, ext: " .swift " , skipsHiddenFiles: skipsHiddenFiles, ignoreFilenameRegex : ignoreFilenameRegex )
111+ try Self . files ( path: $0, ext: " .swift " , skipsHiddenFiles: skipsHiddenFiles, ignoreRegex : ignoreRegex )
112112 }
113113
114114 guard urls. count > 0 else {
@@ -173,7 +173,7 @@ struct SwiftDocCoverage: ParsableCommand {
173173 return cmd
174174 }
175175
176- static func files( path: String , ext: String , skipsHiddenFiles: Bool , ignoreFilenameRegex : String ) throws -> [ URL ] {
176+ static func files( path: String , ext: String , skipsHiddenFiles: Bool , ignoreRegex : String ) throws -> [ URL ] {
177177 var isDirectory : ObjCBool = false
178178 guard FileManager . default. fileExists ( atPath: path, isDirectory: & isDirectory) else {
179179 throw Errors . pathNotFound
@@ -182,9 +182,9 @@ struct SwiftDocCoverage: ParsableCommand {
182182 if isDirectory. boolValue {
183183 var urls = [ URL] ( )
184184
185- let regex : NSRegularExpression ? = ignoreFilenameRegex . isEmpty
185+ let regex : NSRegularExpression ? = ignoreRegex . isEmpty
186186 ? nil
187- : try NSRegularExpression ( pattern: ignoreFilenameRegex )
187+ : try NSRegularExpression ( pattern: ignoreRegex )
188188
189189 let url = URL ( fileURLWithPath: path)
190190 let resourceKeys = Set < URLResourceKey > ( [ . nameKey, . isDirectoryKey] )
@@ -201,9 +201,8 @@ struct SwiftDocCoverage: ParsableCommand {
201201
202202 // Skip by regex
203203 if let regex = regex {
204- let fileName = fileURL. lastPathComponent
205- let range = NSRange ( fileName. startIndex... , in: fileName)
206- if regex. firstMatch ( in: fileName, range: range) != nil {
204+ let path = fileURL. path
205+ if regex. firstMatch ( in: path, range: NSRange ( path. startIndex... , in: path) ) != nil {
207206 continue
208207 }
209208 }
0 commit comments