Skip to content

Use value ScanResult, add Summary & parseError - #108

Merged
keroxp merged 6 commits into
mainfrom
dev-0205
Feb 5, 2026
Merged

Use value ScanResult, add Summary & parseError#108
keroxp merged 6 commits into
mainfrom
dev-0205

Conversation

@keroxp

@keroxp keroxp commented Feb 5, 2026

Copy link
Copy Markdown
Member

Convert ScanResult usage from pointer slices to value slices across scanner, printer, command, mocks and tests. Add ScanResult.Summary() and ScanStaus constants to centralize summary/status calculation and replace the old summaryScanResult helper; update aggregator to store summaries as values and accept ScanResult by value. Add parseError and ErrScanNotFound to map AWS Smithy ScanNotFoundException to a distinct NA status. Update tests and generated mocks accordingly and make github.com/aws/smithy-go a direct dependency in go.mod.

Convert ScanResult usage from pointer slices to value slices across scanner, printer, command, mocks and tests. Add ScanResult.Summary() and ScanStaus constants to centralize summary/status calculation and replace the old summaryScanResult helper; update aggregator to store summaries as values and accept ScanResult by value. Add parseError and ErrScanNotFound to map AWS Smithy ScanNotFoundException to a distinct NA status. Update tests and generated mocks accordingly and make github.com/aws/smithy-go a direct dependency in go.mod.
@codecov

codecov Bot commented Feb 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (be1e40e) to head (969260b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   90.14%   90.11%   -0.03%     
==========================================
  Files          38       38              
  Lines        1695     1690       -5     
==========================================
- Hits         1528     1523       -5     
  Misses        116      116              
  Partials       51       51              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the ScanResult handling across the audit package to use value semantics instead of pointer semantics, and introduces a new Summary() method on ScanResult along with ScanStatus constants. It also adds parseError functionality to distinguish AWS ScanNotFoundException errors from other errors, enabling different status handling for scans that weren't found (N/A) versus scans that failed (ERROR).

Changes:

  • Converted ScanResult from pointer slices ([]*ScanResult) to value slices ([]ScanResult) across scanner, printer, command, and aggregator interfaces
  • Added ScanResult.Summary() method that centralizes status calculation and vulnerability counting, replacing the old summaryScanResult helper function
  • Introduced ScanStatus type (with typo) and constants (OK, WARNING, VULNERABLE, ERROR, N/A) for standardized status values
  • Added parseError function and ErrScanNotFound to map AWS Smithy ScanNotFoundException to N/A status
  • Made github.com/aws/smithy-go a direct dependency in go.mod to support the parseError implementation

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cli/cage/audit/types.go Added ScanResult.Summary() method with ScanStatus constants; removed old summaryScanResult helper
cli/cage/audit/scanner.go Changed Scanner interface to return value slice; added parseError and ErrScanNotFound
cli/cage/audit/aggregator.go Updated Add method to accept ScanResult by value and store summaries as values
cli/cage/audit/printer.go Updated Printer interface methods to accept value slices
cli/cage/audit/command.go Updated doScan return type to value slice
cli/cage/audit/types_test.go Added comprehensive tests for Summary() method including error cases
cli/cage/audit/scanner_test.go Enhanced tests for scanImage function
cli/cage/audit/aggregator_test.go Rewrote tests with more granular test cases
cli/cage/audit/printer_test.go Updated test signatures to use value slices
cli/cage/audit/command_test.go Updated test variables to use value slices
mocks/mock_audit/scanner.go Regenerated mock with updated interface signature
mocks/mock_audit/printer.go Regenerated mock with updated interface signature
go.mod Made smithy-go a direct dependency (removed indirect comment)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli/cage/audit/types.go Outdated
Comment thread cli/cage/audit/types.go Outdated
Comment thread cli/cage/audit/scanner.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli/cage/audit/types_test.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@keroxp
keroxp merged commit 153dfd8 into main Feb 5, 2026
1 check passed
@keroxp
keroxp deleted the dev-0205 branch February 5, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants