Repository navigation
Honor --stop-on-error on cycode scan - #565
Merged
omer-roth merged 4 commits intoOct 5, 2026
Merged
Conversation
The scan command stored stop_on_error in the context, then called apply_sca_restore_options_to_context without it. The helper's parameter defaults to False and overwrites ctx.obj['stop_on_error'], so the flag never took effect on `cycode scan`. Pass it through, as `cycode report sbom path` already does, and drop the redundant assignment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omer-roth
approved these changes
Oct 5, 2026
The scan package re-exports a scan_command function that shadows the submodule. Python 3.9's mock.patch resolves dotted targets with getattr, so it found the function instead of the module. Patch the module object fetched with importlib.import_module instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omer-roth
reviewed
Oct 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
comments resolved |
omer-roth
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
scan_commandnow passesstop_on_errortoapply_sca_restore_options_to_context.ctx.obj['stop_on_error'] = stop_on_errorassignment, since the helper sets it.scancommand, intercepts it atget_scan_cycode_client, and assertsstop_on_erroris still set in the context (parametrized for flag on and off).Why
--stop-on-errorhas had no effect oncycode scansince it was introduced in #416 (first released in v3.12.1). The command wrote the flag intoctx.obj, then calledapply_sca_restore_options_to_context(ctx, no_restore, gradle_all_sub_projects, maven_settings_file). That helper'sstop_on_errorparameter defaults toFalseand writesctx.obj['stop_on_error'], so the user's value was reset before the scan ran.cycode report sbom pathalready passes the flag and was not affected.Customer-reported (support ticket #8445). Repro: a
requirements.txtwith an unresolvable package, thencycode scan -t sca --stop-on-error path .exits 1 with a restore warning instead of exiting 2.Notes for reviewers
FileCollectionError,handle_scan_errorssetsdid_fail, andscan_command_result_callbackexits withSCAN_ERROR_STATUS_CODE(2). That path already had unit coverage; only the context wiring was broken.mainand passes with this change. The scan command and SCA file collector suites (211 tests) pass, and ruff is clean.🤖 Generated with Claude Code