How to set what will be detected in Scan
ScanCode allows you to scan a codebase for license, copyright and other interesting information that can be discovered in files. The following options are available for detection when using ScanCode Toolkit:
All “Basic” Scan Options
Option lists are two-column lists of command-line options and descriptions, documenting a program’s options. For example:
- -c, --copyright
Scan
<input>
for copyrights.Sub-Options:
--consolidate
- -l, --license
Scan
<input>
for licenses.Sub-Options:
--license-references
--license-text
--license-text-diagnostics
--license-diagnostics
--license-url-template TEXT
--license-score INT
--license-clarity-score
--consolidate
--unknown-licenses
- -p, --package
Scan
<input>
for packages.Sub-Options:
--consolidate
- --system-package
Scan
<input>
for installed system package databases.- --package-only
Scan
<input>
for system and application only for package metadata, without license/ copyright detection and package assembly.- -e, --email
Scan
<input>
for emails.Sub-Options:
--max-email INT
- -u, --url
Scan
<input>
for urls.Sub-Options:
--max-url INT
- -i, --info
Scan for and include information such as:
Size,
Type,
Date,
Programming language,
sha1 and md5 hashes,
binary/text/archive/media/source/script flags
Additional options through more CLI options
Sub-Options:
--mark-source
Note
Unlike previous 2.x versions, -c, -l, and -p are not default. If any combination of these
options are used, ScanCode performs only that specific task, and not the others.
scancode -l
scans only for licenses, and doesn’t scan for copyright/packages/general
information/emails/urls. The only notable exception: a --package
scan also has
license information for package manifests and top-level packages, which are derived
regardless of --license
option being used.
Note
These options, i.e. -c, -l, -p, -e, -u, and -i can be used together. As in, instead of
scancode -c -i -p
, you can write scancode -cip
and it will be the same.
- --generated
Classify automatically generated code files with a flag.
- --max-email INT
Report only up to INT emails found in a file. Use 0 for no limit. [Default: 50]
Sub-Option of:
--email
- --max-url INT
Report only up to INT urls found in a file. Use 0 for no limit. [Default: 50]
Sub-Option of:
--url
- --license-score INTEGER
Do not return license matches with scores lower than this score. A number between 0 and 100. [Default: 0] Here, a bigger number means a better match, i.e. Setting a higher license score translates to a higher threshold (with equal or smaller number of matches).
Sub-Option of:
--license
- --license-text
Include the matched text for the detected licenses in the output report.
Sub-Option of:
--license
Sub-Options:
--license-text-diagnostics
- --license-url-template TEXT
Set the template URL used for the license reference URLs.
In a template URL, curly braces ({}) are replaced by the license key. [Default: default: https://scancode-licensedb.aboutcode.org/{}]
Sub-Option of:
--license
- --license-text-diagnostics
In the matched license text, include diagnostic highlights surrounding with square brackets [] words that are not matched.
Sub-Option of:
--license
and--license-text
- --license-diagnostics
In license detections, include diagnostic details to figure out the license detection post processing steps applied.
Sub-Option of:
--license
- --unknown-licenses
[EXPERIMENTAL] Detect unknown licenses.
Sub-Option of:
--license
Different Scans
The following examples will use the samples
directory that is provided with the ScanCode
Toolkit code. All examples will
be saved in the JSON format, which can be loaded into Scancode Workbench for visualization. See
How to Visualize Scan results for more information. Another output format option is a
static html file. See Scancode Output Formats for more information.
Scan for all clues:
To scan for licenses, copyrights, urls, emails, package information, and file information
scancode -clipeu --json output.json samples
Scan for license and copyright clues:
scancode -cl --json-pp output.json samples
Scan for emails and URLs:
scancode -eu --json-pp output.json samples
Scan for package information:
scancode -p --json-pp output.json samples
Scan for file information:
scancode -i --json-pp output.json samples
To see more example scans:
scancode --examples
For more information, refer All Available Options.