diff --git a/src/main/scala/com/codacy/duplication/jscpd/Jscpd.scala b/src/main/scala/com/codacy/duplication/jscpd/Jscpd.scala index 3dc0525..4e54bcd 100644 --- a/src/main/scala/com/codacy/duplication/jscpd/Jscpd.scala +++ b/src/main/scala/com/codacy/duplication/jscpd/Jscpd.scala @@ -64,10 +64,14 @@ object Jscpd extends DuplicationTool { val filePath = o("name").as[String] val startLine = o("start").as[Int] val endLine = o("end").as[Int] + // We found a bug in jscpd where the startLine is, sometimes, bigger than the endLine + // so we need to normalize that + val normalizedStartLine = math.min(startLine, endLine) + val normalizedEndLine = math.max(startLine, endLine) DuplicationCloneFile( filePath = filePath, - startLine = startLine, - endLine = endLine + startLine = normalizedStartLine, + endLine = normalizedEndLine ) }) ) @@ -89,4 +93,4 @@ object Jscpd extends DuplicationTool { } } -object Main extends DockerDuplication(Jscpd)() +object Main extends DockerDuplication(Jscpd)() \ No newline at end of file