Configuration

xdry can be configured via it's json configuration. The configuration file gets automatically loaded from {current working directory}/xdry.json.

You can pass a custom path via the -c option.

An example of a valid configuration:

{
  "settings": {
    "minCloneLengths": {
      "level-1": 10,
      "level-2": 10,
      "level-3": 20
    },
    "logFile": "%pwd%/logs/xdry.log"
  },
  "reports": [
    {
      "type": "json",
      "path": "%pwd%/reports/xdry_report.json"
    },
    {
      "type": "html",
      "path": "%pwd%/reports/xdry_report.html"
    }
  ],
  "directories": [
    "%pwd%/test/_testdata/php/",
    "%pwd%/test/_testdata/javascript/"
  ],
  "normalizers": [
    {
      "level": 1,
      "extension": ".php",
      "language": "php",
      "command": "php",
      "args": [
        "/var/www/bin/console",
        "normalize:level-1",
        "%FILEPATH%"
      ]
    },
    {
      "level": 2,
      "extension": ".php",
      "language": "php",
      "command": "php",
      "args": [
        "/var/www/bin/console",
        "normalize:level-2",
        "%FILEPATH%"
      ]
    },
    {
      "level": 1,
      "extension": ".js",
      "language": "javascript",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-v",
        "%FILEPATH%:/file.js",
        "leovie/x-dry-javascript-plugin:latest",
        "normalize:level-1",
        "/file.js"
      ]
    },
    {
      "level": 2,
      "extension": ".js",
      "language": "javascript",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-v",
        "%FILEPATH%:/file.js",
        "leovie/x-dry-javascript-plugin:latest",
        "normalize:level-2",
        "/file.js"
      ]
    }
  ]
}

settings

minCloneLengths

Under which character length should xdry ignore a level-1 / level-2 / level-3 clone instance?

logFile

Where should xdry store its log?

reports

In which format should xdry report detected clones?

type

Which type does the generated report have?

Currently available types:

  • json --> See example of report here
  • html --> See example of report here

path

Where should xdry store the report? You can use the placeholder %pwd% for the current working directory here.

directories

Which paths should xdry analyze for clones?

normalizers

How can xdry normalize source code in specific languages on different levels?

level

On which level does this normalizer work? See available levels and requirements of a normalizer plugin here

extension

Which file extensions do files, that this normalizer can understand, have?

command

How can xdry call this normalizer? This can be an absolute path to a script or a binary or anything else, that can be called via shell.

args

What arguments are required to call this normalizer? You can use the placeholder %FILEPATH here, which will be replaced by the real filepath of the file which should get normalized.