Skip to content

Structured CLI summary output for analysis results#899

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomainfrom
akim.sadaoui/fix-files-count-output
Apr 30, 2026
Merged

Structured CLI summary output for analysis results#899
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomainfrom
akim.sadaoui/fix-files-count-output

Conversation

@MikaYuoadas
Copy link
Copy Markdown
Contributor

@MikaYuoadas MikaYuoadas commented Apr 24, 2026

Summary

  • The CLI summary lines (Found X violation(s) in Y file(s)...) were ambiguous: the file count only reflected files with findings, not total files scanned
  • Replaced the single-line format with a structured multi-line summary that explicitly reports all metrics: files scanned, files with findings, total findings, rules evaluated, rules with matches, and sub-second duration
  • This also affects downstream stdout parsers that extract these values

Old output format

Found 36 violation(s) in 13 file(s) using 15 rule(s) within 0 sec(s)
Found 2 secret(s) (including 0 valid) in 2 file(s) using 2 rule(s) within 1 sec(s)

New output format

Static Analysis Summary
  Files scanned: 304
  Files with violations: 13
  Total violations: 36
  Rules evaluated: 1053
  Rules with matches: 15
  Duration: 0.652s

Secrets Summary
  Files scanned: 302
  Files with secrets: 2
  Total secrets: 2
  Valid secrets: 0
  Rules evaluated: 238
  Rules with matches: 2
  Duration: 1.168s

Test plan

  • Run the analyzer locally and verify the new output format

Copilot AI review requested due to automatic review settings April 24, 2026 12:46
@MikaYuoadas MikaYuoadas requested a review from a team as a code owner April 24, 2026 12:46
@MikaYuoadas MikaYuoadas requested a review from jasonforal April 24, 2026 12:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the datadog-static-analyzer CLI summary to report the total number of input files analyzed (rather than only files that produced findings), aligning the output with actual scan scope.

Changes:

  • Static analysis summary now reports files_to_analyze.len() as the file count.
  • Secrets summary now reports secrets_files.len() as the file count.
  • Removes the prior “total files” computation derived from results (which excluded empty/no-finding files).

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

Comment thread crates/bins/src/bin/datadog-static-analyzer.rs Outdated
Comment thread crates/bins/src/bin/datadog-static-analyzer.rs Outdated
@datadog-prod-us1-3
Copy link
Copy Markdown

datadog-prod-us1-3 Bot commented Apr 24, 2026

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 84.99% (-0.04%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 1f99a38 | Docs | Datadog PR Page | Give us feedback!

Replace the single-line "Found X violation(s) in Y file(s)..." format
with a structured multi-line summary that separately reports all
relevant metrics: files scanned, files with findings, total findings,
rules evaluated, rules with matches, and sub-second duration.

This removes the ambiguity where "in Y file(s)" could mean either
total files scanned or files with at least one finding, and provides
both values explicitly.
@MikaYuoadas MikaYuoadas force-pushed the akim.sadaoui/fix-files-count-output branch from f6683e5 to 1f99a38 Compare April 28, 2026 09:59
Comment thread crates/bins/src/bin/datadog-static-analyzer.rs Dismissed
Comment thread crates/bins/src/bin/datadog-static-analyzer.rs Dismissed
Comment thread crates/bins/src/bin/datadog-static-analyzer.rs Dismissed
Comment thread crates/bins/src/bin/datadog-static-analyzer.rs Dismissed
@MikaYuoadas MikaYuoadas changed the title Fix CLI output to report total scanned files Structured CLI summary output for analysis results Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants