Skip to content

Commit 4a97637

Browse files
authored
Merge pull request #2698 from agschrei/add-cyclonedx-output-option
Add CycloneDx output option Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2 parents d29292c + af286da commit 4a97637

File tree

14 files changed

+1396
-6
lines changed

14 files changed

+1396
-6
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The following organizations or individuals have contributed to ScanCode:
66
- Agni Bhattacharyya @PyAgni
77
- Akanksha Garg @akugarg
88
- Alex Blekhman @a-tinsmith
9+
- Alexander Gschrei @agschrei
910
- Armijn Hemmel @armijnhemel
1011
- Arnaud Jeansen @ajeans
1112
- Arnav Mandal @arnav-mandal1234

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Package detection:
7373
Outputs:
7474
~~~~~~~~
7575

76-
- There is a new CycloneDX 1.2 output as XML and JSON.
76+
- Add new outputs for the CycloneDx format.
77+
The CLI now exposes options to produce CycloneDx BOMs in either JSON or XML format
7778

7879

7980
Output version

docs/source/cli-reference/output-format.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,4 +576,31 @@ Comparing Different ``json`` Output Formats
576576

577577
----
578578

579+
``--cyclonedx FILE``
580+
--------------------
581+
Scancode also supports the `CycloneDx <https://cyclonedx.org/specification/overview/>`_ output format
582+
583+
Please note that this output format is only useful when scanning with the ``--package`` option
584+
585+
This output format is particularly useful if you want to process ScanCode results
586+
in downstream tools that can't process ScanCode's native JSON output,
587+
but do support CycloneDx BOMs.
588+
589+
To run an example scan on the test resources try:
590+
``./scancode --package --cyclonedx=bom.json tests/formattedcode/data/cyclonedx/simple``
591+
592+
If you prefer XML output over JSON, please have a look at the ``--cyclonedx-xml`` option instead
593+
594+
____
595+
596+
``--cyclonedx-xml FILE``
597+
-------------------------
598+
599+
This option allows outputting CycloneDx BOMs in XML format instead of JSON
600+
601+
To run an example scan on the test resources try:
602+
``./scancode --package --cyclonedx-xml=bom.xml tests/formattedcode/data/cyclonedx/simple``
603+
604+
____
605+
579606
.. include:: /rst_snippets/custom_output_format.rst

docs/source/rst_snippets/output_format_options.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ All Scan Output Options
3131
--html-app FILE Write scan output as a mini HTML
3232
application to FILE.
3333

34+
--cyclonedx FILE Write scan output as a CycloneDx 1.3 BOM
35+
in pretty-printed JSON format to FILE
36+
37+
--cyclonedx-xml FILE Write scan output as a CycloneDx 1.3 BOM
38+
in pretty-printed XML format to FILE
39+
3440
.. include:: /rst_snippets/warning_snippets/output_htmlapp_dep.rst

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ scancode_output =
198198
template = formattedcode.output_html:CustomTemplateOutput
199199
debian = formattedcode.output_debian:DebianCopyrightOutput
200200
yaml = formattedcode.output_yaml:YamlOutput
201+
cyclonedx = formattedcode.output_cyclonedx:CycloneDxJsonOutput
202+
cyclonedx-xml = formattedcode.output_cyclonedx:CycloneDxXmlOutput
201203

202204

203205
[tool:pytest]

0 commit comments

Comments
 (0)