Skip to content

Commit f2b25dc

Browse files
authored
Merge pull request #27 from AyanSinhaMahapatra/v3.1.1
CLI Options Reference for v3.1.1
2 parents e0034d9 + 810dd0b commit f2b25dc

92 files changed

Lines changed: 4097 additions & 248 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/requirements.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
alabaster==0.7.12
2+
Babel==2.7.0
3+
certifi==2019.9.11
4+
chardet==3.0.4
5+
doc8==0.8.0
6+
docutils==0.15.2
7+
idna==2.8
8+
imagesize==1.1.0
9+
Jinja2==2.10.3
10+
MarkupSafe==1.1.1
11+
packaging==19.2
12+
pbr==5.4.3
13+
Pygments==2.4.2
14+
pyparsing==2.4.2
15+
pytz==2019.3
16+
requests==2.22.0
17+
restructuredtext-lint==1.3.0
18+
six==1.12.0
19+
snowballstemmer==2.0.0
20+
Sphinx==2.2.0
21+
sphinx-rtd-theme==0.4.3
22+
sphinxcontrib-applehelp==1.0.1
23+
sphinxcontrib-devhelp==1.0.1
24+
sphinxcontrib-htmlhelp==1.0.2
25+
sphinxcontrib-jsmath==1.0.1
26+
sphinxcontrib-qthelp==1.0.2
27+
sphinxcontrib-serializinghtml==1.1.3
28+
stevedore==1.31.0
29+
urllib3==1.25.6
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
`Basic` Options
2+
===============
3+
4+
.. include:: /scancode-toolkit/rst_snippets/basic_options.rst
5+
6+
----
7+
8+
``--generated`` Options
9+
-----------------------
10+
11+
The ``--generated`` option classifies automatically generated code files with a flag.
12+
13+
An example of using ``--generated`` in a scan::
14+
15+
./scancode -clpieu --json-pp output.json samples --generated
16+
17+
In the results, for each file the following attribute is added with it's corresponding
18+
``true``/``false`` value ::
19+
20+
"is_generated": true
21+
22+
In the samples folder, the following files have a true value for their is_generated attribute::
23+
24+
"samples/zlib/dotzlib/LICENSE_1_0.txt"
25+
"samples/JGroups/licenses/apache-2.0.txt"
26+
27+
..
28+
[ToDo] Research and Write Better
29+
30+
----
31+
32+
``--max-email`` Options
33+
-----------------------
34+
35+
.. admonition:: Dependency
36+
37+
The option ``--max-email`` is a sub-option of and requires the option ``--email``.
38+
39+
If in the files that are scanned, in individual files, there are a lot of emails (i.e lists) which
40+
are unnecessary and clutter the scan results, ``--max-email`` option can be used to report emails
41+
only up to a limit in individual files.
42+
43+
Some important INTEGER values of the ``--max-email INTEGER`` option:
44+
45+
- 0 - No limit, include all emails.
46+
- 50 - Default.
47+
48+
An example usage::
49+
50+
./scancode -clpieu --json-pp output.json samples --max-email 5
51+
52+
This only reports 5 email addresses per file and ignores the rest.
53+
54+
----
55+
56+
``--max-url`` Options
57+
---------------------
58+
59+
.. admonition:: Dependency
60+
61+
The option ``--max-url`` is a sub-option of and requires the option ``--url``.
62+
63+
If in the files that are scanned, in individual files, there are a lot of links to other websites
64+
(i.e url lists) which are unnecessary and clutter the scan results, ``--max-url`` option can be
65+
used to report urls only up to a limit in individual files.
66+
67+
Some important INTEGER values of the ``--max-url INTEGER`` option:
68+
69+
- 0 - No limit, include all urls.
70+
- 50 - Default.
71+
72+
An example usage::
73+
74+
./scancode -clpieu --json-pp output.json samples --max-url 10
75+
76+
This only reports 10 urls per file and ignores the rest.
77+
78+
----
79+
80+
``--license-score`` Options
81+
---------------------------
82+
83+
.. admonition:: Dependency
84+
85+
The option ``--license-score`` is a sub-option of and requires the option ``--license``.
86+
87+
..
88+
[ToDo] Research and Write License Matching Better
89+
90+
License matching strictness, i.e. How closely matched licenses are detected in a scan, can be
91+
modified by using this ``--license-score`` option.
92+
93+
Some important INTEGER values of the ``--license-score INTEGER`` option:
94+
95+
- **0** - Default and Lowest Value, All matches are reported.
96+
- **100** - Highest Value, Only licenses with a much better match are reported
97+
98+
Here, a bigger number means a better match, i.e. Setting a higher license score translates to a
99+
higher threshold for matching licenses (with equal or less number of license matches).
100+
101+
An example usage::
102+
103+
./scancode -clpieu --json-pp output.json samples --license-score 70
104+
105+
Here's the license results on setting the integer value to 100, Vs. the default value 0. This is
106+
visualized using ScanCode workbench in the License Info Dashboard.
107+
108+
.. list-table:: License scan results of Samples Directory.
109+
110+
* - .. figure:: data/core_lic_score_0.png
111+
112+
License Score 0 (Default).
113+
114+
- .. figure:: data/core_lic_score_100.png
115+
116+
License Score 100.
117+
118+
----
119+
120+
``--license-text`` Options
121+
--------------------------
122+
123+
.. admonition:: Dependency
124+
125+
The option ``--license-text`` is a sub-option of and requires the option ``--license``.
126+
127+
.. admonition:: Sub-Option
128+
129+
The option ``--license-text-diagnostics`` and ``--is-license-text`` are sub-options of
130+
``--license-text``. ``--is-license-text`` is a Post-Scan Option.
131+
132+
With the ``--license-text`` option, the scan results attribute "matched text" includes the matched text
133+
for the detected license.
134+
135+
An example Scan::
136+
137+
./scancode -cplieu --json-pp output.json samples --license-text
138+
139+
An example matched text included in the results is as follows::
140+
141+
"matched_text":
142+
" This software is provided 'as-is', without any express or implied
143+
warranty. In no event will the authors be held liable for any damages
144+
arising from the use of this software.
145+
Permission is granted to anyone to use this software for any purpose,
146+
including commercial applications, and to alter it and redistribute it
147+
freely, subject to the following restrictions:
148+
1. The origin of this software must not be misrepresented; you must not
149+
claim that you wrote the original software. If you use this software
150+
in a product, an acknowledgment in the product documentation would be
151+
appreciated but is not required.
152+
2. Altered source versions must be plainly marked as such, and must not be
153+
misrepresented as being the original software.
154+
3. This notice may not be removed or altered from any source distribution.
155+
156+
Jean-loup Gailly Mark Adler
157+
jloup@gzip.org madler@alumni.caltech.edu"
158+
159+
- The file in which this license was detected: ``samples/arch/zlib.tar.gz-extract/zlib-1.2.8/zlib.h``
160+
- License name: "ZLIB License"
161+
162+
----
163+
164+
``--license-url-template`` Options
165+
----------------------------------
166+
167+
.. admonition:: Dependency
168+
169+
The option ``--license-url-template`` is a sub-option of and requires the option
170+
``--license``.
171+
172+
The ``--license-url-template`` option sets the template URL used for the license reference URLs.
173+
174+
The default template URL is : [https://enterprise.dejacode.com/urn/urn:dje:license:{}]
175+
In a template URL, curly braces ({}) are replaced by the license key.
176+
177+
So, by default the license reference URL points to the dejacode page for that license.
178+
179+
A scan example using the ``--license-url-template TEXT`` option ::
180+
181+
./scancode -clpieu --json-pp output.json samples --license-url-template https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/{}.yml
182+
183+
In a normal scan, reference url for "ZLIB License" is as follows::
184+
185+
"reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:zlib",
186+
187+
After using the option in the following manner::
188+
189+
``--license-url-template https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/{}``
190+
191+
the reference URL changes to this `zlib.yml file <https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/data/licenses/zlib.yml>`_::
192+
193+
"reference_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/zlib.yml",
194+
195+
The reference URL changes for all detected licenses in the scan, across the scan result file.
196+
197+
----
198+
199+
``--license-text-diagnostics`` Options
200+
--------------------------------------
201+
202+
.. admonition:: Dependency
203+
204+
The option ``--license-text-diagnostics`` is a sub-option of and requires the options
205+
``--license`` and ``--license-text``.
206+
207+
In the matched license text, include diagnostic highlights surrounding with square brackets []
208+
words that are not matched.
209+
210+
In a normal scan, whole lines of text are included in the matched license text, including parts
211+
that are possibly unmatched.
212+
213+
An example Scan::
214+
215+
./scancode -cplieu --json-pp output.json samples --license-text --license-text-diagnostics
216+
217+
Running a scan on the samples directory with ``--license-text --license-text-diagnostics`` options,
218+
causes the following difference in the scan result of the file
219+
``samples/JGroups/licenses/bouncycastle.txt``.
220+
221+
Without Diagnostics::
222+
223+
"matched_text":
224+
"License Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle
225+
(http://www.bouncycastle.org) Permission is hereby granted, free of charge, to any person
226+
obtaining a copy of this software and associated documentation files (the \"Software\"),
227+
to deal in the Software without restriction
228+
229+
With Diagnostics on::
230+
231+
"matched_text":
232+
"License [Copyright] ([c]) [2000] - [2006] [The] [Legion] [Of] [The] [Bouncy] [Castle]
233+
([http]://[www].[bouncycastle].[org]) Permission is hereby granted, free of charge, to any person
234+
obtaining a copy of this software and associated documentation files (the \"Software\"),
235+
to deal in the Software without restriction,
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
`Core` Options
2+
==============
3+
4+
.. _cli_core:
5+
6+
.. include:: /scancode-toolkit/rst_snippets/core_options.rst
7+
8+
----
9+
10+
Comparing Progress Message Options
11+
----------------------------------
12+
13+
**Default Progress Message**::
14+
15+
Scanning files for: infos, licenses, copyrights, packages, emails, urls with 1 process(es)...
16+
Building license detection index...Done.
17+
Scanning files...
18+
[####################] 43
19+
Scanning done.
20+
Scan statistics: 43 files scanned in 33s.
21+
Scan options: infos, licenses, copyrights, packages, emails, urls with 1 process(es).
22+
Scanning speed: 1.4 files per sec.
23+
Scanning time: 30s.
24+
Indexing time: 2s.
25+
Saving results.
26+
27+
**Progress Message with ``--verbose``**::
28+
29+
Scanning files for: infos, licenses, copyrights, packages, emails, urls with 1 process(es)...
30+
Building license detection index...Done.
31+
Scanning files...
32+
Scanned: screenshot.png
33+
Scanned: README
34+
...
35+
Scanned: zlib/dotzlib/ChecksumImpl.cs
36+
Scanned: zlib/dotzlib/readme.txt
37+
Scanned: zlib/gcc_gvmat64/gvmat64.S
38+
Scanned: zlib/ada/zlib.ads
39+
Scanned: zlib/infback9/infback9.c
40+
Scanned: zlib/infback9/infback9.h
41+
Scanned: arch/zlib.tar.gz
42+
Scanning done.
43+
Scan statistics: 43 files scanned in 29s.
44+
Scan options: infos, licenses, copyrights, packages, emails, urls with 1 process(es).
45+
Scanning speed: 1.58 files per sec.
46+
Scanning time: 27s.
47+
Indexing time: 2s.
48+
Saving results.
49+
50+
So, with ``--verbose`` enables, progress messages for individual files are shown.
51+
52+
**With the ``--quiet`` option enabled**, nothing is printed on the Command Line.
53+
54+
----
55+
56+
``--timeout`` Option
57+
--------------------
58+
59+
This option sets scan timeout for **each file** (and not the entire scan). If some file scan
60+
exceeds the specified timeout, that file isn't scanned anymore and the next file scanning
61+
starts. This helps avoiding very large/long files, and saves time.
62+
63+
Also the number (timeout in seconds) to be followed by this option can be a
64+
floating point number, i.e. 1.5467.
65+
66+
----
67+
68+
``--reindex-licenses`` Option
69+
-----------------------------
70+
71+
ScanCode maintains a license index to search for and detect licenses. When Scancode is
72+
configured for the first time, a license index is built and used in every scan thereafter.
73+
74+
This ``--reindex-licenses`` option rebuilds the license index. Running a scan with this option
75+
displays the following message to the terminal in addition to what it normally shows::
76+
77+
Checking and rebuilding the license index...
78+
79+
..
80+
[ToDo] Research and Write Better
81+
82+
----
83+
84+
``--from-json`` Option
85+
----------------------
86+
87+
If you want to input scan results from a .json file, and run a scan again on those same files,
88+
with some other options/output format, you can do so using the ``--from-json`` option.
89+
90+
An example scan command using ``--from-json``::
91+
92+
./scancode --from-json sample.json --json-pp sample_2.json --classify
93+
94+
This inputs the scan results from ``sample.json``, runs the post-scan plugin ``--classify`` and
95+
outputs the results for this scan to ``sample_2.json``.
96+
97+
----
98+
99+
``--max-in-memory`` Option
100+
----------------------------------
101+
102+
During a scan, as individual files are scanned, the scan details for those files are kept on
103+
memory till the scan is completed. Then after the scan is completed, they are written in the
104+
specified output format.
105+
106+
Now, if the scan involves a very large number of files, they might not fit in the memory during
107+
the scan. For this reason, disk-caching can be used for some/all of the files.
108+
109+
Some important INTEGER values of the ``--max-in-memory INTEGER`` option:
110+
111+
- **0** - Unlimited Memory, store all the file/directory scan results on memory
112+
- **-1** - Use only Disk-Caching, store all the file/directory scan results on disk
113+
- **10000** - Default, store 10,000 file/directory scan results on memory and the rest on disk
114+
115+
An example usage::
116+
117+
./scancode -clieu --json-pp sample.json samples --max-in-memory -1
51.3 KB
Loading
64.8 KB
Loading
231 KB
Loading
220 KB
Loading
123 KB
Loading
101 KB
Loading
99 KB
Loading

0 commit comments

Comments
 (0)