LinuxCommandLibrary

phpcpd

phpcpd

TLDR

Analyze duplicated code for a specific file or directory

$ phpcpd [path/to/file_or_directory]
copy


Analyze using fuzzy matching for variable names
$ phpcpd --fuzzy [path/to/file_or_directory]
copy


Specify a minimum number of identical lines (defaults to 5)
$ phpcpd --min-lines [number_of_lines] [path/to/file_or_directory]
copy


Specify a minimum number of identical tokens (defaults to 70)
$ phpcpd --min-tokens [number_of_tokens] [path/to/file_or_directory]
copy


Exclude a directory from analysis (must be relative to the source)
$ phpcpd --exclude [path/to/excluded_directory] [path/to/file_or_directory]
copy


Output the results to a PHP-CPD XML file
$ phpcpd --log-pmd [path/to/log_file] [path/to/file_or_directory]
copy

SYNOPSIS

phpcpd [options] <directory>

DESCRIPTION

Copy and paste detector (CPD) for PHP code. This tool provides details about duplicated lines inside a PHP project.

Options for selecting files:

--suffix <suffix> Include files with names ending in <suffix> in the analysis

(default: .php; can be given multiple times)

--exclude <path>

Exclude files with <path> in their path from the analysis (can be given multiple times)

Options for analysing files:

--fuzzy

Fuzz variable names

--min-lines <N>

Minimum number of identical lines (default: 5)

--min-tokens <N>

Minimum number of identical tokens (default: 70)

Options for report generation:

--log-pmd <file>

Write log in PMD-CPD XML format to <file>

Copied to clipboard