Skip to content

Commit fe5179e

Browse files
Fix doc tests and update docs
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent f437798 commit fe5179e

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
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/misc/faq.rst

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,23 @@ reported are based on the strings extracted from the binaries, typically broken
8484
as new lines with each NULL character.
8585

8686

87-
How does ``--license-text`` for ScanCode works exactly?
87+
How does ``--license-text`` for ScanCode works exactly?
8888
-------------------------------------------------------------
8989

90-
I have a question about how ``--license-text`` for ScanCode works exactly:
91-
Is the matched text that gets included into the result exactly the lines of text
92-
from the input file that are covered by the ``start_line`` and ``end_line``
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``
9392
fields of the result? I.e., if I would post-process the input file and extract
94-
``start_line`` to ``end_line`` from it, would I get exactly the ``matched_text``
93+
``start_line`` to ``end_line`` from it, would I get exactly the ``matched_text``
9594
contents? Or is there some more "magic" involved when populating the
96-
``matched_text`` field?
95+
``matched_text`` field?
9796

9897
ScanCode is a bit smarter than just start and end line, as matching is based on
99-
words, not lines of the actual scanned text.
100-
And a whole line may not always be matched.
98+
words, not lines of the actual scanned text. And a whole line may not always be matched.
10199

102100
For instance with this command::
103101

104-
$ echo "Foo is a wonder piece of code. Licensed under the GPL. For support contact [email protected] " > tst
102+
$ echo "Foo is a wonder piece of code. Licensed under the GPL. " \
103+
"For support contact [email protected] " > tst
105104
$ scancode --license --license-text --license-text-diagnostics --yaml - tst
106105
...
107106
license_detections:
@@ -128,16 +127,8 @@ For instance with this command::
128127
then:
129128

130129
- ``matched_text`` is based on ``start_line`` and ``end_line``
131-
- ``matched_text_diagnostics`` is based on the exact matched words (and it includes "tagged" gaps or extra)
132-
133-
134-
135-
136-
137-
138-
139-
140-
141-
130+
- ``matched_text_diagnostics`` is based on the exact matched words
142131

132+
Note that ``matched_text_diagnostics`` also includes "tagged" gaps or extra
133+
unmatched words highlighted between the matched words.
143134

0 commit comments

Comments
 (0)