MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / scancode

Function scancode

src/scancode/cli.py:405–556  ·  view source on GitHub ↗

scan the file or directory for license, origin and packages and save results to FILE(s) using one or more output format option. Error and progress are printed to stderr.

(
    ctx,
    input,  # NOQA
    ignore,
    strip_root,
    full_root,
    processes,
    timeout,
    quiet,
    verbose,
    max_depth,
    from_json,
    timing,
    max_in_memory,
    test_mode,
    test_slow_mode,
    test_error_mode,
    keep_temp_files,
    check_version,
    echo_func=echo_stderr,
    *args,
    **kwargs,
)

Source from the content-addressed store, hash-verified

403 hidden=True,
404 help_group=cliutils.MISC_GROUP, sort_order=1000, cls=PluggableCommandLineOption)
405def scancode(
406 ctx,
407 input, # NOQA
408 ignore,
409 strip_root,
410 full_root,
411 processes,
412 timeout,
413 quiet,
414 verbose,
415 max_depth,
416 from_json,
417 timing,
418 max_in_memory,
419 test_mode,
420 test_slow_mode,
421 test_error_mode,
422 keep_temp_files,
423 check_version,
424 echo_func=echo_stderr,
425 *args,
426 **kwargs,
427):
428 """scan the <input> file or directory for license, origin and packages and save results to FILE(s) using one or more output format option.
429
430 Error and progress are printed to stderr.
431 """
432
433 # notes: the above docstring of this function is used in the CLI help Here is
434 # it's actual docstring:
435 """
436 This function is the main ScanCode CLI entry point.
437
438 Return a return code of 0 on success or a positive integer on error from
439 running all the scanning "stages" with the `input` file or
440 directory.
441
442 The scanning stages are:
443
444 - `inventory`: collect the codebase inventory resources tree for the
445 `input`. This is a built-in stage that does not accept plugins.
446
447 - `setup`: as part of the plugins system, each plugin is loaded and
448 its `setup` method is called if it is enabled.
449
450 - `pre-scan`: each enabled pre-scan plugin `process_codebase(codebase)`
451 method is called to update/transforme the whole codebase.
452
453 - `scan`: the codebase is walked and each enabled scan plugin
454 `get_scanner()` scanner function is called once for each codebase
455 resource receiving the `resource.location` as an argument.
456
457 - `post-scan`: each enabled post-scan plugin `process_codebase(codebase)`
458 method is called to update/transform the whole codebase.
459
460 - `output_filter`: the `process_resource` method of each enabled
461 output_filter plugin is called on each resource to determine if the
462 resource should be kept or not in the output stage.

Callers 1

cli.pyFile · 0.85

Calls 5

check_scancode_versionFunction · 0.90
get_pretty_paramsFunction · 0.85
exitMethod · 0.80
logger_debugFunction · 0.70
run_scanFunction · 0.70

Tested by

no test coverage detected