File tree 1 file changed +7
-4
lines changed
src/main/scala/com/codacy/transformation
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -16,20 +16,23 @@ object FileNameMatcher {
16
16
Try (Paths .get(filename).getFileName.toString.toLowerCase).getOrElse(filename.toLowerCase)
17
17
}
18
18
19
+ private def normalizePath (path : String ): String = {
20
+ path.replace(" \\ " , " /" )
21
+ }
22
+
19
23
private def haveSameName (file : String , covFile : String ): Boolean =
20
24
getFilenameFromPath(file) == getFilenameFromPath(covFile)
21
25
22
26
private def haveSamePath (file : String , covFile : String ): Boolean =
23
- file == covFile
27
+ normalizePath( file) == normalizePath( covFile)
24
28
25
29
private def fileEndsWithReportPath (file : String , covFile : String ): Boolean =
26
- file.endsWith(covFile)
30
+ normalizePath( file) .endsWith(normalizePath( covFile) )
27
31
28
32
private def reportEndsWithFilePath (file : String , covFile : String ): Boolean =
29
- covFile.endsWith(file)
33
+ normalizePath( covFile) .endsWith(normalizePath( file) )
30
34
31
35
private def isTheSameFile (file : String , covFile : String ): Boolean = {
32
-
33
36
haveSameName(file, covFile) && (haveSamePath(file, covFile) ||
34
37
fileEndsWithReportPath(file, covFile) ||
35
38
reportEndsWithFilePath(file, covFile))
You can’t perform that action at this time.
0 commit comments