Discover modules > cue.dev/x/npmjs/jscpd
v0.2.0
#Schema: ¶
minLines?: int ¶

minimum size of code block in lines to check for duplication

maxLines?: int ¶

maximum size of source file in lines to check for duplication

maxSize?: matchN(>=1, [=~"^\\+?[0-9]+(\\.[0-9]+)? *([kKmMgGtTpP]?[bB]|[kKmMgG])?$", int]) ¶

maximum size of source file in bytes to check for duplication (e.g., 102400, 1kb, 1m, 120kb)

minTokens?: int ¶

minimum size of code block in tokens to check for duplication

threshold?: number ¶

maximum allowed duplicate lines expressed as a percentage; exit with error and exit code 1 when threshold exceeded

formatsExts?: #formatMapping ¶
output?: string ¶

path to directory for non-console reports

path?: [...string] ¶

paths that should be included in duplicate detection (default: [process.cwd()])

pattern?: string ¶

glob pattern for files that should be included in duplicate detection (e.g., **/*.txt); only used to filter directories configured via path option

ignorePattern?: [...string] ¶

ignore code blocks matching these regular expressions

mode?: "mild" | "strict" | "weak" ¶

mode of detection quality; see https://github.com/kucherenko/jscpd/blob/master/packages/jscpd/README.md#mode

ignore?: [...string] ¶

glob pattern for files that should be excluded from duplicate detection

format?: matchN(1, [[...#format], #format]) ¶

format or list of formats for which to detect duplication (default: all); see https://github.com/kucherenko/jscpd/blob/master/FORMATS.md

store?: matchN(>=1, ["leveldb" | "redis", strings.MinRunes(1)]) ¶

store used to collect information about code. v4 supports external stores such as leveldb and redis; v5 reports this config field as migrated to the CLI --store flag.

reporters?: [...#reporter] ¶

a list of reporters to use to output information about duplication; built-ins include console, consoleFull/console-full, json, xml, csv, html, markdown, badge, sarif, ai, xcode, threshold, and silent; third-party reporters are also supported

blame?: bool ¶

get information about authors and dates of duplicated blocks from Git

silent?: bool ¶

do not write duplicate detection progress and result to console

verbose?: bool ¶

show full information during duplicate detection

absolute?: bool ¶

use absolute paths in reports

noSymlinks?: bool ¶

do not follow symlinks

skipLocal?: bool ¶

skip duplicates within folders; just detect cross-folder duplicates

ignoreCase?: bool ¶

ignore case of symbols in code (experimental)

gitignore?: bool ¶

respect .gitignore files. Enabled by default in current jscpd; set false to opt out in v4 configs.

reportersOptions?: ¶
badge?: ¶
path?: string ¶

output path for duplication level badge (default: path.join(output, 'jscpd-badge.svg'))

label?: string ¶

badge subject text (URL-encoding needed for spaces or special characters)

labelColor?: #color ¶
status?: string ¶

badge value text (URL-encoding needed for spaces or special characters, default: duplication %)

color?: #color ¶
style?: "flat" | "classic" ¶

badge look: flat or classic

icon?: string ¶

URL for icon to display in front of badge subject text (e.g., data:image/svg+xml;base64,...)

iconWidth?: number ¶

SVG width of icon to display in front of badge subject text; set this if icon is not square

scale?: number ¶

size of badge relative to default of 1

exitCode?: int ¶

exit code to use when at least one duplicate code block is detected but threshold is not exceeded

formatsNames?: #formatMapping ¶
formats?: matchN(1, [[...#format], #format]) ¶

v5 alias for format; format or list of formats for which to detect duplication

storePath?: string ¶

directory used by the v4 store for cache files, useful for isolating parallel LevelDB runs. v5 reports this config field as migrated to the CLI --store-path flag.

noGitignore?: bool ¶

v5 config field matching --no-gitignore; do not respect .gitignore files

followSymlinks?: bool ¶

v5 config field matching --follow-symlinks; follow symbolic links

noSymLinks?: bool ¶

compatibility alias for noSymlinks with a capital L; prefer noSymlinks or followSymlinks

noColors?: bool ¶

disable ANSI color output

noTips?: bool ¶

suppress tips and promotional messages after detection

debug?: bool ¶

show debug information and do not run detection in v4; silently ignored by v5 config compatibility handling

"min-tokens"?: int ¶

v5 kebab-case alias for minTokens. minimum size of code block in tokens to check for duplication

"min-lines"?: int ¶

v5 kebab-case alias for minLines. minimum size of code block in lines to check for duplication

"max-lines"?: int ¶

v5 kebab-case alias for maxLines. maximum size of source file in lines to check for duplication

"max-size"?: matchN(>=1, [=~"^\\+?[0-9]+(\\.[0-9]+)? *([kKmMgGtTpP]?[bB]|[kKmMgG])?$", int]) ¶

v5 kebab-case alias for maxSize. maximum size of source file in bytes to check for duplication (e.g., 102400, 1kb, 1m, 120kb)

"ignore-pattern"?: [...string] ¶

v5 kebab-case alias for ignorePattern. ignore code blocks matching these regular expressions

"ignore-case"?: bool ¶

v5 kebab-case alias for ignoreCase. ignore case of symbols in code (experimental)

"no-gitignore"?: bool ¶

v5 kebab-case alias for noGitignore. v5 config field matching --no-gitignore; do not respect .gitignore files

"follow-symlinks"?: bool ¶

v5 kebab-case alias for followSymlinks. v5 config field matching --follow-symlinks; follow symbolic links

"skip-local"?: bool ¶

v5 kebab-case alias for skipLocal. skip duplicates within folders; just detect cross-folder duplicates

"exit-code"?: int ¶

v5 kebab-case alias for exitCode. exit code to use when at least one duplicate code block is detected but threshold is not exceeded

"no-colors"?: bool ¶

v5 kebab-case alias for noColors. disable ANSI color output

"no-tips"?: bool ¶

v5 kebab-case alias for noTips. suppress tips and promotional messages after detection

"formats-exts"?: #formatMapping ¶
"formats-names"?: #formatMapping ¶
#color: matchN(1, [#colorPreset, #colorHex]) ¶
#colorHex: =~"([0-9a-fA-F]{3}){1,2}" ¶
#colorPreset: "green" | "blue" | "red" | "yellow" | "orange" | "purple" | "pink" | "grey" | "gray" | "cyan" | "black" ¶
#format:
click to see definition
matchN(>=1, [
	"abap" |
		"actionscript" |
		"ada" |
		"apacheconf" |
		"apl" |
		"applescript" |
		"arduino" |
		"arff" |
		"asciidoc" |
		"asm6502" |
		"aspnet" |
		"autohotkey" |
		"autoit" |
		"bash" |
		"basic" |
		"batch" |
		"bison" |
		"brainfuck" |
		"bro" |
		"c" |
		"c-header" |
		"clike" |
		"clojure" |
		"coffeescript" |
		"comments" |
		"cpp" |
		"cpp-header" |
		"crystal" |
		"csharp" |
		"csp" |
		"css-extras" |
		"css" |
		"d" |
		"dart" |
		"diff" |
		"django" |
		"docker" |
		"eiffel" |
		"elixir" |
		"elm" |
		"erb" |
		"erlang" |
		"flow" |
		"fortran" |
		"fsharp" |
		"gdscript" |
		"gedcom" |
		"gherkin" |
		"git" |
		"glsl" |
		"go" |
		"graphql" |
		"groovy" |
		"haml" |
		"handlebars" |
		"haskell" |
		"haxe" |
		"hpkp" |
		"hsts" |
		"http" |
		"ichigojam" |
		"icon" |
		"inform7" |
		"ini" |
		"io" |
		"j" |
		"java" |
		"javascript" |
		"jolie" |
		"json" |
		"jsx" |
		"julia" |
		"keymap" |
		"kotlin" |
		"latex" |
		"less" |
		"liquid" |
		"lisp" |
		"livescript" |
		"lolcode" |
		"lua" |
		"makefile" |
		"markdown" |
		"markup" |
		"matlab" |
		"mel" |
		"mizar" |
		"monkey" |
		"n4js" |
		"nasm" |
		"nginx" |
		"nim" |
		"nix" |
		"nsis" |
		"objectivec" |
		"ocaml" |
		"opencl" |
		"oz" |
		"parigp" |
		"pascal" |
		"perl" |
		"php" |
		"plsql" |
		"powershell" |
		"processing" |
		"prolog" |
		"properties" |
		"protobuf" |
		"pug" |
		"puppet" |
		"pure" |
		"python" |
		"q" |
		"qore" |
		"r" |
		"razor" |
		"reason" |
		"renpy" |
		"rest" |
		"rip" |
		"roboconf" |
		"ruby" |
		"rust" |
		"sas" |
		"sass" |
		"scala" |
		"scheme" |
		"scss" |
		"svelte" |
		"smalltalk" |
		"smarty" |
		"soy" |
		"sql" |
		"stylus" |
		"swift" |
		"tap" |
		"tcl" |
		"textile" |
		"tsx" |
		"tt2" |
		"twig" |
		"typescript" |
		"txt" |
		"vbnet" |
		"velocity" |
		"verilog" |
		"vhdl" |
		"vim" |
		"visual-basic" |
		"astro" |
		"vue" |
		"wasm" |
		"wiki" |
		"xeora" |
		"xojo" |
		"xquery" |
		"yaml" |
		"abnf" |
		"agda" |
		"antlr4" |
		"apex" |
		"aql" |
		"armasm" |
		"awk" |
		"bicep" |
		"bnf" |
		"cfscript" |
		"cfml" |
		"cmake" |
		"cobol" |
		"csv" |
		"cypher" |
		"dhall" |
		"dns-zone-file" |
		"dot" |
		"ebnf" |
		"editorconfig" |
		"excel-formula" |
		"factor" |
		"ftl" |
		"gcode" |
		"gettext" |
		"gml" |
		"go-module" |
		"hcl" |
		"hlsl" |
		"idris" |
		"ignore" |
		"jq" |
		"json5" |
		"kusto" |
		"lilypond" |
		"linker-script" |
		"llvm" |
		"log" |
		"mermaid" |
		"mongodb" |
		"n1ql" |
		"odin" |
		"openqasm" |
		"plant-uml" |
		"powerquery" |
		"promql" |
		"purescript" |
		"qsharp" |
		"racket" |
		"regex" |
		"rego" |
		"rescript" |
		"robotframework" |
		"shell-session" |
		"smali" |
		"solidity" |
		"sparql" |
		"stata" |
		"toml" |
		"turtle" |
		"typoscript" |
		"unrealscript" |
		"uri" |
		"vala" |
		"wgsl" |
		"wolfram" |
		"zig",
	strings.MinRunes(1),
])
¶
#formatMapping: matchN(>=1, [{[string]: matchN(1, [[...string], string])}, [...string], string]) ¶
#reporter:
click to see definition
matchN(>=1, [
	"ai" |
		"badge" |
		"console" |
		"console-full" |
		"consoleFull" |
		"csv" |
		"full" |
		"html" |
		"json" |
		"markdown" |
		"sarif" |
		"silent" |
		"threshold" |
		"xcode" |
		"xml",
	strings.MinRunes(1),
])
¶

Source files

  • schema.cue