Skip to content

Commit 6feeb08

Browse files
authored
CM-25594 - Drop support of the old position of --output option (#148)
1 parent b17d9b2 commit 6feeb08

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

cycode/cli/main.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,6 @@
7575
type=bool,
7676
required=False,
7777
)
78-
@click.option(
79-
'--output',
80-
'-o',
81-
default=None,
82-
help="""
83-
\b
84-
Specify the results output (text/json/table),
85-
the default is text
86-
""",
87-
type=click.Choice(['text', 'json', 'table']),
88-
)
8978
@click.option(
9079
'--severity-threshold',
9180
default=None,
@@ -127,7 +116,6 @@ def code_scan(
127116
client_id: str,
128117
show_secret: bool,
129118
soft_fail: bool,
130-
output: str,
131119
severity_threshold: str,
132120
sca_scan: List[str],
133121
monitor: bool,
@@ -143,15 +131,8 @@ def code_scan(
143131
else:
144132
context.obj['soft_fail'] = config['soft_fail']
145133

146-
context.obj['scan_type'] = scan_type
147-
148-
# save backward compatability with old style command
149-
if output is not None:
150-
context.obj['output'] = output
151-
if output == 'json':
152-
context.obj['no_progress_meter'] = True
153-
154134
context.obj['client'] = get_cycode_client(client_id, secret, not context.obj['show_secret'])
135+
context.obj['scan_type'] = scan_type
155136
context.obj['severity_threshold'] = severity_threshold
156137
context.obj['monitor'] = monitor
157138
context.obj['report'] = report

tests/cli/test_main.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ def _is_json(plain: str) -> bool:
2525

2626
@responses.activate
2727
@pytest.mark.parametrize('output', ['text', 'json'])
28-
@pytest.mark.parametrize('option_space', ['scan', 'global'])
29-
def test_passing_output_option(
30-
output: str, option_space: str, scan_client: 'ScanClient', api_token_response: responses.Response
31-
) -> None:
28+
def test_passing_output_option(output: str, scan_client: 'ScanClient', api_token_response: responses.Response) -> None:
3229
scan_type = 'secret'
3330

3431
responses.add(get_zipped_file_scan_response(get_zipped_file_scan_url(scan_type, scan_client)))
@@ -37,18 +34,7 @@ def test_passing_output_option(
3734
# This raises connection error on the attempt to report scan.
3835
# It doesn't perform real request
3936

40-
args = ['scan', '--soft-fail', 'path', str(_PATH_TO_SCAN)]
41-
42-
if option_space == 'global':
43-
global_args = ['--output', output]
44-
global_args.extend(args)
45-
46-
args = global_args
47-
elif option_space == 'scan':
48-
# test backward compatability with old style command
49-
args.insert(2, '--output')
50-
args.insert(3, output)
51-
37+
args = ['--output', output, 'scan', '--soft-fail', 'path', str(_PATH_TO_SCAN)]
5238
result = CliRunner().invoke(main_cli, args, env=CLI_ENV_VARS)
5339

5440
except_json = output == 'json'

0 commit comments

Comments
 (0)