Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It thinks whole file is duplicated #13

Open
hwzhao opened this issue Aug 24, 2016 · 8 comments
Open

It thinks whole file is duplicated #13

hwzhao opened this issue Aug 24, 2016 · 8 comments

Comments

@hwzhao
Copy link

hwzhao commented Aug 24, 2016

When I integrate the cpd4sbt 1.2.0, I got the result like

<?xml version="1.0" encoding="utf-8"?>
<pmd-cpd>
   <duplication lines="408" tokens="2626">
      <file line="1" path="D:\program\rrx\app\services\WechatService.scala"/>
      <file line="1" path="D:\program\rrx\app\services\WechatService.scala"/>
      <codefragment><![CDATA[package services
import java.security.MessageDigest
...

It seems whole file is duplicated, and there are all my scala files in the xml file.
build.sbt:

lazy val root = (project in file(".")).enablePlugins(PlayScala, CopyPasteDetector, BuildInfoPlugin).
  settings(
    buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
    buildInfoPackage := "tool"
  )

plugins.sbt

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

addSbtPlugin("de.johoop" % "cpd4sbt" % "1.2.0")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
@nikayou
Copy link

nikayou commented Feb 13, 2017

Same problem here

@gurghet
Copy link

gurghet commented Feb 6, 2018

+1

@keith-coursera
Copy link

I am seeing this problem in sbt-cpd 2.0.0 as well. Files are being compared with themselves. This is what I added to plugins.sbt:

addSbtPlugin("com.github.sbt" % "sbt-cpd" % "2.0.0")

jtjeferreira added a commit to jtjeferreira/sbt-cpd that referenced this issue Jun 20, 2018
@jtjeferreira
Copy link

while #19 is not merged and release, you can add to your settings as a workaround

CpdKeys.cpdSourceDirectories in Compile := (CpdKeys.cpdSourceDirectories in Compile).value.distinct

@keith-coursera
Copy link

@jtjeferreira add to settings where?

@jtjeferreira
Copy link

@jtjeferreira add to settings where?

you must add that line to your project settings. For example if you use build.sbt add that line to the file...

@keith-coursera
Copy link

@jtjeferreira adding that line to build.sbt gives an error

error: not found: value CpdKeys
CpdKeys.cpdSourceDirectories in Compile := (CpdKeys.cpdSourceDirectories in Compile).value.distinct
^
[error] Type error in expression

@jtjeferreira
Copy link

@keith-coursera you have to import com.github.sbt.cpd.CpdKeys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants