Controlling Scancode Output and Filters

All “Output Control” Scan Options

--strip-root

Strip the root directory segment of all paths.

--full-root

Report full, absolute paths.

Note

The options --strip-root and --full-root can’t be used together, i.e. Any one option may be used in a single scan.

Note

The default is to always include the last directory segment of the scanned path such that all paths have a common root directory.

--ignore-author <pattern>

Ignore a file (and all its findings) if an author contains a match to the <pattern> regular expression.

--ignore-copyright-holder <pattern>

Ignore a file (and all its findings) if a copyright holder contains a match to the <pattern> regular expression.

Note

Note that this both the options --ignore-author and --ignore-copyright-holder will ignore a file even if it has other scanned data such as a license or errors.

--only-findings

Only return files or directories with findings for the requested scans. Files and directories without findings are omitted (file information is not treated as findings).


--strip-root Vs. --full-root

For a default scan of the “samples” folder, this a comparison between the default, strip-root and full-root options.

An example Scan

scancode -cplieu --json-pp output.json samples --full-root

These two changes only the “path” attribute of the file information. For this comparison we compare the “path” attributes of the file LICENSE inside JGroups directory.

The default path:

"path": "samples/JGroups/LICENSE",

For the --full-root option, the path relative to the Root of your local filesystem.

"path": "/home/aboutcode/scancode-toolkit/samples/JGroups/LICENSE"

For the --strip-root option, the root directory (here /home/aboutcode/scancode-toolkit/samples/) is removed from path :

"path": "JGroups/LICENSE"

Note

The options --strip-root and --full-root can’t be used together, i.e. Any one option may be used in a single scan.

Note

The default is to always include the last directory segment of the scanned path such that all paths have a common root directory.


--ignore-author <pattern> Option

In a normal scan, all files inside the directory specified as an input argument is scanned and subsequently included in the scan report. But if you want to run the scan on only some selective files, with some specific common author then --ignore-author option can be used to do the same.

This scan ignores all files with authors matching the string “Apache Software Foundation”:

scancode -cplieu --json-pp output.json samples --ignore-author "Apache Software Foundation"

More information on Glob Pattern Matching.

Note

Note that this both the options --ignore-author and --ignore-copyright-holder will ignore a file even if it has other scanned data such as a license or errors.



--only-findings Plugin

This option removes from the scan results, the files where nothing significant has been detected, like files which doesn’t contain any licenses, copyrights, emails or urls (if requested in the scan options), and isn’t a package.

An example Scan:

scancode -cplieu --json-pp output.json samples --only-findings

Note

This also changes in the result displayed, the number of files scanned.

For example, scanning the sample files (distributed by default with scancode-toolkit) without this option, displays in it’s report information of 43 files. But after enabling this option, the result shows information for only 31 files.