Skip to content

Commit 534318a

Browse files
Merge branch 'develop' into release-prep-v32.4.1
2 parents eb35a65 + 6e43a4f commit 534318a

File tree

4 files changed

+73
-7
lines changed

4 files changed

+73
-7
lines changed

docs/source/cli-reference/basic-options.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,8 @@
623623
The option ``--license-text-diagnostics`` is a sub-option of and requires the options
624624
``--license`` and ``--license-text``.
625625

626-
In the matched license text, include diagnostic highlights surrounding with square brackets []
627-
words that are not matched.
626+
This adds a new attribute like the matched license text, but includes diagnostic highlights
627+
surrounding with square brackets ``[]`` for words that are not matched.
628628

629629
In a normal scan, whole lines of text are included in the matched license text, including parts
630630
that are possibly unmatched.
@@ -645,9 +645,14 @@
645645
obtaining a copy of this software and associated documentation files (the \"Software\"),
646646
to deal in the Software without restriction
647647

648-
With Diagnostics on::
648+
With Diagnostics on (new attribute with the matched text diagnostics)::
649649

650650
"matched_text":
651+
"License Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle
652+
(http://www.bouncycastle.org) Permission is hereby granted, free of charge, to any person
653+
obtaining a copy of this software and associated documentation files (the \"Software\"),
654+
to deal in the Software without restriction
655+
"matched_text_diagnostics":
651656
"License [Copyright] ([c]) [2000] - [2006] [The] [Legion] [Of] [The] [Bouncy] [Castle]
652657
([http]://[www].[bouncycastle].[org]) Permission is hereby granted, free of charge, to any person
653658
obtaining a copy of this software and associated documentation files (the \"Software\"),

docs/source/cli-reference/scan-options-pre.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ Pre-Scan Options
6868

6969
- key-file
7070

71-
A KEY file is a generic file extension used by various programs when registering legal copies
72-
of the software. It may be saved in a plain text format, but generally contains some form of
73-
encrypted key string that authenticates the purchase and registers the software.
71+
A KEY file serves as a keystone element, containing essential
72+
information about a software package — such as its dependencies,
73+
versioning, licensing, and more. It often contains the
74+
``primary-license`` or the overall license of the package, among
75+
other package metadata which are general or ecosystem specific.
7476

7577
As in, to the JSON object of each file scanned, these extra attributes are added::
7678

docs/source/getting-started/install.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ under assets options.
146146
sudo add-apt-repository ppa:deadsnakes/ppa --yes
147147
sudo apt-get install python3.9 python3.9-distutils
148148

149+
.. _linux_mac_app_install:
149150

150151
Installation on Linux and Mac
151152
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -212,7 +213,7 @@ Installation on Windows 10/11
212213

213214
.. note::
214215

215-
On Windows 10, double-click the new folder, select one of the files inside the folder
216+
On Windows, double-click the new folder, select one of the files inside the folder
216217
(e.g., 'setup.py'), and right-click.
217218

218219
- In the pop-up menu select 'Properties'.
@@ -259,6 +260,14 @@ Un-installation
259260
under a ScanCode-prefixed directory such as .scancode-tk or .cache/scancode-tk.
260261

261262

263+
.. note::
264+
265+
The above installation process can be used with **Command Prompt**
266+
``cmd``, and **PowerShell**. **Git Bash** is not tested and using it may
267+
introduce unexpected behavior. If you're using **Windows Subsystem for
268+
Linux** ``WSL2``, please refer to :ref:`linux_mac_app_install` section
269+
above.
270+
262271
----
263272

264273
.. _docker_install:

docs/source/misc/faq.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,53 @@ When scanning binaries, the line numbers are just a relative indication of where
8282
a detection was found: there is no such thing as lines in a binary. The numbers
8383
reported are based on the strings extracted from the binaries, typically broken
8484
as new lines with each NULL character.
85+
86+
87+
How does ``--license-text`` for ScanCode works exactly?
88+
-------------------------------------------------------------
89+
90+
Is the matched text that gets included into the result exactly the lines of text
91+
from the input file that are covered by the ``start_line`` and ``end_line``
92+
fields of the result? I.e., if I would post-process the input file and extract
93+
``start_line`` to ``end_line`` from it, would I get exactly the ``matched_text``
94+
contents? Or is there some more "magic" involved when populating the
95+
``matched_text`` field?
96+
97+
ScanCode is a bit smarter than just start and end line, as matching is based on
98+
words, not lines of the actual scanned text. And a whole line may not always be matched.
99+
100+
For instance with this command::
101+
102+
$ echo "Foo is a wonder piece of code. Licensed under the GPL. " \
103+
"For support contact [email protected] " > tst
104+
$ scancode --license --license-text --license-text-diagnostics --yaml - tst
105+
...
106+
license_detections:
107+
- license_expression: gpl-1.0-plus
108+
license_expression_spdx: GPL-1.0-or-later
109+
matches:
110+
- license_expression: gpl-1.0-plus
111+
license_expression_spdx: GPL-1.0-or-later
112+
from_file: tst
113+
start_line: 1
114+
end_line: 1
115+
matcher: 2-aho
116+
score: '100.0'
117+
matched_length: 4
118+
match_coverage: '100.0'
119+
rule_relevance: 100
120+
rule_identifier: gpl_85.RULE
121+
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl_85.RULE
122+
matched_text: Foo is a wonder piece of code. Licensed under the GPL.
123+
For support contact [email protected]
124+
matched_text_diagnostics: Licensed under the GPL.
125+
...
126+
127+
then:
128+
129+
- ``matched_text`` is based on ``start_line`` and ``end_line``
130+
- ``matched_text_diagnostics`` is based on the exact matched words
131+
132+
Note that ``matched_text_diagnostics`` also includes "tagged" gaps or extra
133+
unmatched words highlighted between the matched words.
134+

0 commit comments

Comments
 (0)