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:

  • --consolidate

  • --license-score INT

  • --license-text

  • --license-url-template TEXT

  • --license-text-diagnostics

  • --is-license-text

-p, --package

Scan <input> for packages.

Sub-Options:

  • --consolidate

-e, --email

Scan <input> for emails.

Sub-Options:

  • --max-email INT

-u, --url

Scan <input> for urls.

Sub-Options:

  • --max-url INT

-i, --info

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 of combination of these options are used, ScanCode only performs that specific task, and not the others. scancode -e only scans for emails, and doesn’t scan for copyright/license/packages/general information.

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 less 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

  • --is-license-text

--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: https://enterprise.dejacode.com/urn/urn:dje:license:{}]

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

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.

Note

For more information on the Scan Command for Various Installation Methods/Operating Systems, refer Installation.

Scan for all clues:

To scan for licenses, copyrights, urls, emails, package information, and file information

scancode -clipeu --json 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.