Skip to content

Commit caa95a6

Browse files
committed
Deprecate --csv command line option #3047
Reference: #3047 Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 69da5ef commit caa95a6

File tree

3 files changed

+51
-16
lines changed

3 files changed

+51
-16
lines changed

CHANGELOG.rst

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@ Changelog
22
=========
33

44

5-
31.0.0 (next, roadmap)
5+
6+
32.0.0 (next next, roadmap)
7+
---------------------------
8+
9+
Package detection:
10+
~~~~~~~~~~~~~~~~~~
11+
12+
- We now support new package manifest formats:
13+
- OpenWRT packages.
14+
- Yocto/BitBake .bb recipes.
15+
16+
17+
18+
31.0.0 (next)
619
-----------------------
720

821
This is a major release with important bug and security fixes, new and improved
@@ -151,10 +164,6 @@ License detection:
151164
Package detection:
152165
~~~~~~~~~~~~~~~~~~
153166

154-
- We now support new package manifest formats:
155-
- OpenWRT packages.
156-
- Yocto/BitBake .bb recipes.
157-
158167
- Major changes in package detection and reporting, codebase-level attribute `packages`
159168
with one or more `package_data` and files for the packages are reported.
160169
The specific changes made are:
@@ -189,9 +198,8 @@ Package detection:
189198
- For Pypi packages, python_requires is treated as a package dependency.
190199

191200

192-
193-
License Clarity Scoring Update
194-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201+
License Clarity Scoring Update:
202+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195203

196204
- We are moving away from the original license clarity scoring designed for
197205
ClearlyDefined in the license clarity score plugin. The previous license
@@ -251,8 +259,8 @@ License Clarity Scoring Update
251259
- Scoring Weight = -20
252260

253261

254-
Summary Plugin Update
255-
~~~~~~~~~~~~~~~~~~~~~
262+
Summary Plugin Update:
263+
~~~~~~~~~~~~~~~~~~~~~~
256264

257265
- The summary plugin's behavior has been changed. Previously, it provided a
258266
count of the detected license expressions, copyrights, holders, authors, and
@@ -276,11 +284,16 @@ All summary information is provided at the codebase-level attribute named ``summ
276284
Outputs:
277285
~~~~~~~~
278286

279-
- Added new outputs for the CycloneDx format.
280-
The CLI now exposes options to produce CycloneDx BOMs in either JSON or XML format
287+
- Added new outputs for the CycloneDx format.
288+
The CLI now exposes options to produce CycloneDx BOMs in either JSON or XML format
289+
290+
- A new field ``warnings`` has been added to the headers of ScanCode toolkit output
291+
that contains any warning messages that occur during a scan.
281292

282-
- A new field ``warnings`` has been added to the headers of ScanCode toolkit output
283-
that contains any warning messages that occur during a scan.
293+
- The CSV output format --csv option is now deprecated. It will be replaced by
294+
new CSV and tabular output formats in the next ScanCode release.
295+
Visit https://github.com/nexB/scancode-toolkit/issues/3047 to provide inputs
296+
and feedback.
284297

285298

286299
Output version
@@ -299,16 +312,19 @@ Changes:
299312
- The fields of the license clarity scoring plugin have been replaced with the
300313
following fields. An overview of the new fields can be found in the "License
301314
Clarity Scoring Update" section above.
315+
302316
- `score`
303317
- `declared_license`
304318
- `identification_precision`
305319
- `has_license_text`
306320
- `declared_copyrights`
307321
- `conflicting_license_categories`
308322
- `ambigious_compound_licensing`
323+
309324
- The fields of the summary plugin have been replaced with the following fields.
310325
An overview of the new fields can be found in the "Summary Plugin Update"
311326
section above.
327+
312328
- `declared_license_expression`
313329
- `license_clarity_score`
314330
- `declared_holder`

src/formattedcode/output_csv.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#
99
import attr
1010
import csv
11+
import warnings
1112

1213
import saneyaml
1314

@@ -38,6 +39,12 @@ def logger_debug(*args):
3839
return logger.debug(' '.join(isinstance(a, str)
3940
and a or repr(a) for a in args))
4041

42+
DEPRECATED_MSG = (
43+
'The --csv option is deprecated and will be replaced by new CSV and '
44+
'tabular output formats in the next ScanCode release. '
45+
'Visit https://github.com/nexB/scancode-toolkit/issues/3047 to provide inputs and feedback.'
46+
)
47+
4148

4249
@output_impl
4350
class CsvOutput(OutputPlugin):
@@ -46,7 +53,7 @@ class CsvOutput(OutputPlugin):
4653
PluggableCommandLineOption(('--csv',),
4754
type=FileOptionType(mode='w', encoding='utf-8', lazy=True),
4855
metavar='FILE',
49-
help='Write scan output as CSV to FILE.',
56+
help='[DEPRECATED] Write scan output as CSV to FILE. ' + DEPRECATED_MSG,
5057
help_group=OUTPUT_GROUP,
5158
sort_order=30),
5259
]
@@ -55,6 +62,14 @@ def is_enabled(self, csv, **kwargs):
5562
return csv
5663

5764
def process_codebase(self, codebase, csv, **kwargs):
65+
warnings.warn(
66+
DEPRECATED_MSG,
67+
DeprecationWarning,
68+
stacklevel=1
69+
)
70+
import click
71+
click.secho('[DEPRECATION WARNING] ' + DEPRECATED_MSG, err=True)
72+
5873
results = self.get_files(codebase, **kwargs)
5974
write_csv(results, csv)
6075

tests/scancode/data/help/help.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ Options:
4545
--json-pp FILE Write scan output as pretty-printed JSON to FILE.
4646
--json-lines FILE Write scan output as JSON Lines to FILE.
4747
--yaml FILE Write scan output as YAML to FILE.
48-
--csv FILE Write scan output as CSV to FILE.
48+
--csv FILE [DEPRECATED] Write scan output as CSV to FILE. The
49+
--csv option is deprecated and will be replaced by new
50+
CSV and tabular output formats in the next ScanCode
51+
release. Visit https://github.com/nexB/scancode-
52+
toolkit/issues/3047 to provide inputs and feedback.
4953
--html FILE Write scan output as HTML to FILE.
5054
--custom-output FILE Write scan output to FILE formatted with the custom
5155
Jinja template file.

0 commit comments

Comments
 (0)