Command-line interface#

swh scanner scan#

Scan a source code project to discover files and directories already present in the archive.

The command can provide different output using the –output-format option:

summary: display a general summary of what the scanner found
text: display the scan result as a text based tree-like view of all the

file, using color to indicate the file status.

json: write all collected data on standard output as JSON

json: write all collected data on standard output as Newline Delimited JSON

sunburst: produce a dynamic chart as .html file. (in $PWD/chart.html)

The source code project can be checked using different policies that can be set using the -p/–policy option:

auto: it selects the best policy based on the source code, for codebase(s)
with less than 1000 file/dir contents all the nodes will be queried.

bfs: scan the source code in the BFS order, checking unknown directories only.

greedybfs: same as “bfs” policy, but lookup the status of source code artifacts
in chunks, in order to minimize the number of Web API round-trips with the
archive.
filepriority: scan all the source code file contents, checking only unset
directories. (useful if the codebase contains a lot of source files)

dirpriority: scan all the source code directories and check only unknown directory contents.

randomdir: scan the source code using a random Merkle search on directories.

Other information about software artifacts could be specified with the -e/ –extra-info option:

origin: search the origin url of each source code files/dirs using the in-memory
compressed graph.
swh scanner scan [OPTIONS] [ROOT_PATH]

Options

-u, --api-url <API_URL>#

URL for the api request

-x, --exclude <PATTERN>#

Exclude directories using glob patterns (e.g., *.git to exclude all .git directories)

-f, --output-format <out_fmt>#

The output format

Default:

summary

Options:

summary | text | json | ndjson | sunburst

-i, --interactive#

Show the result in a dashboard

-p, --policy <policy>#

The scan policy.

Default:

auto

Options:

auto | bfs | greedybfs | filepriority | dirpriority | randomdir

-e, --extra-info <extra_info>#

Add selected additional information about known software artifacts.

Options:

origin

Arguments

ROOT_PATH#

Optional argument