cue.dev/x/npmjs/jscpd@v0.5.0

schema.cue raw

  1package jscpd
  2
  3import "strings"
  4
  5#Schema: {
  6	@jsonschema(schema="http://json-schema.org/draft-07/schema#")
  7	@jsonschema(id="https://json.schemastore.org/jscpd.json")
  8	close({
  9		// minimum size of code block in lines to check for duplication
 10		"minLines"?: int
 11
 12		// maximum size of source file in lines to check for duplication
 13		"maxLines"?: int
 14
 15		// maximum size of source file in bytes to check for duplication (e.g., 102400, 1kb, 1m, 120kb)
 16		"maxSize"?: matchN(>=1, [=~"^\\+?[0-9]+(\\.[0-9]+)? *([kKmMgGtTpP]?[bB]|[kKmMgG])?$", int])
 17
 18		// minimum size of code block in tokens to check for duplication
 19		"minTokens"?: int
 20
 21		// maximum allowed duplicate lines expressed as a percentage; exit with error
 22		// and exit code 1 when threshold exceeded
 23		"threshold"?:   number
 24		"formatsExts"?: #formatMapping
 25
 26		// path to directory for non-console reports
 27		"output"?: string
 28
 29		// paths that should be included in duplicate detection (default: [process.cwd()])
 30		"path"?: [...string]
 31
 32		// glob pattern for files that should be included in duplicate detection (e.g.,
 33		// **/*.txt); only used to filter directories configured via path option
 34		"pattern"?: string
 35
 36		// ignore code blocks matching these regular expressions
 37		"ignorePattern"?: [...string]
 38
 39		// mode of detection quality; see
 40		// https://github.com/kucherenko/jscpd/blob/master/packages/jscpd/README.md#mode
 41		"mode"?: "mild" | "strict" | "weak"
 42
 43		// glob pattern for files that should be excluded from duplicate detection
 44		"ignore"?: [...string]
 45
 46		// format or list of formats for which to detect duplication (default: all); see
 47		// https://github.com/kucherenko/jscpd/blob/master/FORMATS.md
 48		"format"?: matchN(1, [[...#format], #format])
 49
 50		// store used to collect information about code. v4 supports external stores
 51		// such as leveldb and redis; v5 reports this config field as migrated to the
 52		// CLI --store flag.
 53		"store"?: matchN(>=1, ["leveldb" | "redis", strings.MinRunes(1)])
 54
 55		// a list of reporters to use to output information about duplication; built-ins
 56		// include console, consoleFull/console-full, json, xml, csv, html, markdown,
 57		// badge, sarif, ai, xcode, threshold, and silent; third-party reporters are
 58		// also supported
 59		"reporters"?: [...#reporter]
 60
 61		// get information about authors and dates of duplicated blocks from Git
 62		"blame"?: bool
 63
 64		// do not write duplicate detection progress and result to console
 65		"silent"?: bool
 66
 67		// show full information during duplicate detection
 68		"verbose"?: bool
 69
 70		// use absolute paths in reports
 71		"absolute"?: bool
 72
 73		// do not follow symlinks
 74		"noSymlinks"?: bool
 75
 76		// skip duplicates within folders; just detect cross-folder duplicates
 77		"skipLocal"?: bool
 78
 79		// ignore case of symbols in code (experimental)
 80		"ignoreCase"?: bool
 81
 82		// respect .gitignore files. Enabled by default in current jscpd; set false to
 83		// opt out in v4 configs.
 84		"gitignore"?: bool
 85		"reportersOptions"?: {
 86			"badge"?: close({
 87				// output path for duplication level badge (default: path.join(output, 'jscpd-badge.svg'))
 88				"path"?: string
 89
 90				// badge subject text (URL-encoding needed for spaces or special characters)
 91				"label"?:      string
 92				"labelColor"?: #color
 93
 94				// badge value text (URL-encoding needed for spaces or special characters, default: duplication %)
 95				"status"?: string
 96				"color"?:  #color
 97
 98				// badge look: flat or classic
 99				"style"?: "flat" | "classic"
100
101				// URL for icon to display in front of badge subject text (e.g., data:image/svg+xml;base64,...)
102				"icon"?: string
103
104				// SVG width of icon to display in front of badge subject text; set this if icon is not square
105				"iconWidth"?: number
106
107				// size of badge relative to default of 1
108				"scale"?: number
109			})
110			...
111		}
112
113		// exit code to use when at least one duplicate code block is detected but threshold is not exceeded
114		"exitCode"?:     int
115		"formatsNames"?: #formatMapping
116
117		// v5 alias for format; format or list of formats for which to detect duplication
118		"formats"?: matchN(1, [[...#format], #format])
119
120		// directory used by the v4 store for cache files, useful for isolating parallel
121		// LevelDB runs. v5 reports this config field as migrated to the CLI
122		// --store-path flag.
123		"storePath"?: string
124
125		// v5 config field matching --no-gitignore; do not respect .gitignore files
126		"noGitignore"?: bool
127
128		// v5 config field matching --follow-symlinks; follow symbolic links
129		"followSymlinks"?: bool
130
131		// compatibility alias for noSymlinks with a capital L; prefer noSymlinks or followSymlinks
132		"noSymLinks"?: bool
133
134		// disable ANSI color output
135		"noColors"?: bool
136
137		// suppress tips and promotional messages after detection
138		"noTips"?: bool
139
140		// show debug information and do not run detection in v4; silently ignored by v5
141		// config compatibility handling
142		"debug"?: bool
143
144		// v5 kebab-case alias for minTokens. minimum size of code block in tokens to check for duplication
145		"min-tokens"?: int
146
147		// v5 kebab-case alias for minLines. minimum size of code block in lines to check for duplication
148		"min-lines"?: int
149
150		// v5 kebab-case alias for maxLines. maximum size of source file in lines to check for duplication
151		"max-lines"?: int
152
153		// v5 kebab-case alias for maxSize. maximum size of source file in bytes to
154		// check for duplication (e.g., 102400, 1kb, 1m, 120kb)
155		"max-size"?: matchN(>=1, [=~"^\\+?[0-9]+(\\.[0-9]+)? *([kKmMgGtTpP]?[bB]|[kKmMgG])?$", int])
156
157		// v5 kebab-case alias for ignorePattern. ignore code blocks matching these regular expressions
158		"ignore-pattern"?: [...string]
159
160		// v5 kebab-case alias for ignoreCase. ignore case of symbols in code (experimental)
161		"ignore-case"?: bool
162
163		// v5 kebab-case alias for noGitignore. v5 config field matching --no-gitignore;
164		// do not respect .gitignore files
165		"no-gitignore"?: bool
166
167		// v5 kebab-case alias for followSymlinks. v5 config field matching
168		// --follow-symlinks; follow symbolic links
169		"follow-symlinks"?: bool
170
171		// v5 kebab-case alias for skipLocal. skip duplicates within folders; just
172		// detect cross-folder duplicates
173		"skip-local"?: bool
174
175		// v5 kebab-case alias for exitCode. exit code to use when at least one
176		// duplicate code block is detected but threshold is not exceeded
177		"exit-code"?: int
178
179		// v5 kebab-case alias for noColors. disable ANSI color output
180		"no-colors"?: bool
181
182		// v5 kebab-case alias for noTips. suppress tips and promotional messages after detection
183		"no-tips"?:       bool
184		"formats-exts"?:  #formatMapping
185		"formats-names"?: #formatMapping
186	})
187
188	#color: matchN(1, [#colorPreset, #colorHex])
189
190	#colorHex: =~"([0-9a-fA-F]{3}){1,2}"
191
192	#colorPreset: "green" |
193		"blue" |
194		"red" |
195		"yellow" |
196		"orange" |
197		"purple" |
198		"pink" |
199		"grey" |
200		"gray" |
201		"cyan" |
202		"black"
203
204	#format: matchN(>=1, [
205		"abap" |
206			"actionscript" |
207			"ada" |
208			"apacheconf" |
209			"apl" |
210			"applescript" |
211			"arduino" |
212			"arff" |
213			"asciidoc" |
214			"asm6502" |
215			"aspnet" |
216			"autohotkey" |
217			"autoit" |
218			"bash" |
219			"basic" |
220			"batch" |
221			"bison" |
222			"brainfuck" |
223			"bro" |
224			"c" |
225			"c-header" |
226			"clike" |
227			"clojure" |
228			"coffeescript" |
229			"comments" |
230			"cpp" |
231			"cpp-header" |
232			"crystal" |
233			"csharp" |
234			"csp" |
235			"css-extras" |
236			"css" |
237			"d" |
238			"dart" |
239			"diff" |
240			"django" |
241			"docker" |
242			"eiffel" |
243			"elixir" |
244			"elm" |
245			"erb" |
246			"erlang" |
247			"flow" |
248			"fortran" |
249			"fsharp" |
250			"gdscript" |
251			"gedcom" |
252			"gherkin" |
253			"git" |
254			"glsl" |
255			"go" |
256			"graphql" |
257			"groovy" |
258			"haml" |
259			"handlebars" |
260			"haskell" |
261			"haxe" |
262			"hpkp" |
263			"hsts" |
264			"http" |
265			"ichigojam" |
266			"icon" |
267			"inform7" |
268			"ini" |
269			"io" |
270			"j" |
271			"java" |
272			"javascript" |
273			"jolie" |
274			"json" |
275			"jsx" |
276			"julia" |
277			"keymap" |
278			"kotlin" |
279			"latex" |
280			"less" |
281			"liquid" |
282			"lisp" |
283			"livescript" |
284			"lolcode" |
285			"lua" |
286			"makefile" |
287			"markdown" |
288			"markup" |
289			"matlab" |
290			"mel" |
291			"mizar" |
292			"monkey" |
293			"n4js" |
294			"nasm" |
295			"nginx" |
296			"nim" |
297			"nix" |
298			"nsis" |
299			"objectivec" |
300			"ocaml" |
301			"opencl" |
302			"oz" |
303			"parigp" |
304			"pascal" |
305			"perl" |
306			"php" |
307			"plsql" |
308			"powershell" |
309			"processing" |
310			"prolog" |
311			"properties" |
312			"protobuf" |
313			"pug" |
314			"puppet" |
315			"pure" |
316			"python" |
317			"q" |
318			"qore" |
319			"r" |
320			"razor" |
321			"reason" |
322			"renpy" |
323			"rest" |
324			"rip" |
325			"roboconf" |
326			"ruby" |
327			"rust" |
328			"sas" |
329			"sass" |
330			"scala" |
331			"scheme" |
332			"scss" |
333			"svelte" |
334			"smalltalk" |
335			"smarty" |
336			"soy" |
337			"sql" |
338			"stylus" |
339			"swift" |
340			"tap" |
341			"tcl" |
342			"textile" |
343			"tsx" |
344			"tt2" |
345			"twig" |
346			"typescript" |
347			"txt" |
348			"vbnet" |
349			"velocity" |
350			"verilog" |
351			"vhdl" |
352			"vim" |
353			"visual-basic" |
354			"astro" |
355			"vue" |
356			"wasm" |
357			"wiki" |
358			"xeora" |
359			"xojo" |
360			"xquery" |
361			"yaml" |
362			"abnf" |
363			"agda" |
364			"antlr4" |
365			"apex" |
366			"aql" |
367			"armasm" |
368			"awk" |
369			"bicep" |
370			"bnf" |
371			"cfscript" |
372			"cfml" |
373			"cmake" |
374			"cobol" |
375			"csv" |
376			"cypher" |
377			"dhall" |
378			"dns-zone-file" |
379			"dot" |
380			"ebnf" |
381			"editorconfig" |
382			"excel-formula" |
383			"factor" |
384			"ftl" |
385			"gcode" |
386			"gettext" |
387			"gml" |
388			"go-module" |
389			"hcl" |
390			"hlsl" |
391			"idris" |
392			"ignore" |
393			"jq" |
394			"json5" |
395			"kusto" |
396			"lilypond" |
397			"linker-script" |
398			"llvm" |
399			"log" |
400			"mermaid" |
401			"mongodb" |
402			"n1ql" |
403			"odin" |
404			"openqasm" |
405			"plant-uml" |
406			"powerquery" |
407			"promql" |
408			"purescript" |
409			"qsharp" |
410			"racket" |
411			"regex" |
412			"rego" |
413			"rescript" |
414			"robotframework" |
415			"shell-session" |
416			"smali" |
417			"solidity" |
418			"sparql" |
419			"stata" |
420			"toml" |
421			"turtle" |
422			"typoscript" |
423			"unrealscript" |
424			"uri" |
425			"vala" |
426			"wgsl" |
427			"wolfram" |
428			"zig",
429		strings.MinRunes(1),
430	])
431
432	#formatMapping: matchN(>=1, [{[string]: matchN(1, [[...string], string])}, [...string], string])
433
434	#reporter: matchN(>=1, [
435		"ai" |
436			"badge" |
437			"console" |
438			"console-full" |
439			"consoleFull" |
440			"csv" |
441			"full" |
442			"html" |
443			"json" |
444			"markdown" |
445			"sarif" |
446			"silent" |
447			"threshold" |
448			"xcode" |
449			"xml",
450		strings.MinRunes(1),
451	])
452}