GithubHelp home page GithubHelp logo

cpd4sbt's Introduction

cpd4sbt - Static code analysis via PMD/CPD from within SBT

This SBT plug-in enables you to analyze your code with the help of the great PMD Copy/Paste Detector tool. It defines a cpd sbt action for that purpose.

For SBT 0.13, you've basically got to add the following to your project's build.sbt file:

enablePlugins(CopyPasteDetector)

Also, you have to add the plugin dependency to your project's ./project/plugins.sbt or the global .sbt/project/build.sbt:

addSbtPlugin("de.johoop" % "cpd4sbt" % "1.2.0")

The settings specified below are still mostly valid, but they're now specified using the new settings system of SBT 0.13.

Change Log

  • 1.2.0
    • Converted plugin to an auto-plugin
    • Updated PMD/CPD to version 1.5.2
    • Added test project
    • Fixed readme a bit
  • 1.1.5
    • Added settings for the CPD command line switches ignore-annotations, ignore-literals, ignore-identifiers, skip-duplicate-files and skip-lexical-errors
    • Added cs and plsql languages (and fixed a typo)
    • Added option to print the CPD report to the console

Settings

(see also the CPD documentation)

cpdReportType

  • Description: Selects the output format for the CPD report. Requires to import import de.johoop.cpd4sbt._.
  • Accepts: ReportType.{Simple, XML, CSV, VS}
  • Default: ReportType.Xml

cpdTargetPath

  • Description: Output path for CPD reports.
  • Accepts: any sbt.Path
  • Default: outputPath / "cpd"

cpdReportName

  • Description: Name of the report file to generate.
  • Accepts: any legal filename
  • Default: "cpd.xml"

cpdOutputType

  • Description: Selects the output type for the CPD report. Requires to import import de.johoop.cpd4sbt._.
  • Accepts: OutputType.{File, Console}
  • Default: OutputType.File

cpdLanguage

  • Description: Language to analyze. - If you want Scala specifically, you still need to extend the CPD tokenizers! Otherwise, choosing Scala will default to the "AnyLanguage" tokenizer
  • Accepts: Language.{Java, C, CPP, CS, PHP, Ruby, Fortran, ECMAScript, JavaScript, JSP, PLSQL, Scala}
  • Default: Language.Scala

cpdMaxMemoryInMB

  • Description: Maximum amount of memory to allow for CPD (in MB).
  • Accepts: any reasonable amount of memory as an integer value
  • Default: 512

cpdMinimumTokens

  • Description: Minimum number of tokens of potential duplicates.
  • Accepts: A positive Int
  • Default: 100

cpdSourceEncoding

  • Description: Source file encoding.
  • Accepts: String representations of valid encodings.
  • Default: "utf-8"

cpdOutputEncoding

  • Description: Output file encoding.
  • Accepts: String representations of valid encodings.
  • Default: "utf-8"

cpdSourceDirectories

  • Description: Paths of the source files to analyze.
  • Accepts: A List of Paths
  • Default: List(mainSourcePath).

cpdSkipDuplicateFiles

  • Description: Ignore multiple copies of files of the same name and length in comparison.
  • Accepts: Boolean
  • Default: false

cpdSkipLexicalErrors

  • Description: Skip files which can't be tokenized due to invalid characters instead of aborting.
  • Accepts: Boolean
  • Default: false

cpdIgnoreLiterals

  • Description: Ignore literal value differences when evaluating a duplicate block.
  • Accepts: Boolean
  • Default: false

cpdIgnoreIdentifiers

  • Description: Ignore identifier name differences when evaluating a duplicate block.
  • Accepts: Boolean
  • Default: false

cpdIgnoreAnnotations

  • Description: Ignore language annotations when evaluating a duplicate block.
  • Accepts: Boolean
  • Default: false

Contributors

Many thanks to

for their awesome contributions!

License

This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html

cpd4sbt's People

Contributors

jmhofer avatar hairyfotr avatar corux avatar jentsch avatar nightscape avatar

Watchers

Mike avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.